d

D Operator Precedence levels (version 1.0)

Does anyone know where the listing for levels of operator precedence for D version 1.0 are located on line? ...

D operators that are not in C++

Are there any operators in D that are not in C++? ...

Generalized plugable caching pattern?

Given that it's one of the hard things in computer science, does anyone know of a way to set up a plugable caching strategy? What I'm thinking of would allow me to write a program with minimal thought as to what needs to be cached (e.i. use some sort of boiler-plate, low/no cost pattern that compiles away to nothing anywhere I might wa...

What is the underlying reason for not being able to put arrays of pointers in unsafe structs in C#?

If one could put an array of pointers to child structs inside unsafe structs in C# like one could in C, constructing complex data structures without the overhead of having one object per node would be a lot easier and less of a time sink, as well as syntactically cleaner and much more readable. Is there a deep architectural reason why ...

Get class instance by class name string

Hi all, I noticed the function Object.factory(char[] className) in D. But it does not work like I hoped it would work; it does not work ;) An example: import std.stdio; class TestClass { override string toString() { return typeof(this).stringof; // TestClass } }; void main(string[] args) { auto i = Object.fac...

Language D compared to C++?

Anyone here with experience of the language D? I was just reading through its presentation at http://www.d-programming-language.org/ and at Wikipedia and it seems like a good (better) alternative to C++. With good/better I mean that it seem simpler yet it has all the good stuff within C/C++. But without some of the difficulties that m...

Link compatibility between C++ and D

D easily interfaces with C. D just as easily interfaces with C++, but (and it's a big but) the C++ needs to be extremely trivial. The code cannot use: namespaces templates multiple inheritance mix virtual with non-virtual methods more? I completely understand the inheritance restriction. The rest however, feel like artificial limi...

How to make a object (class) foreachable in D?

Hi, how can I make a class usable in a foreach statement? The class contains a associative array (e.g. string[string]). So the foreach statement use this array as source. So this is what I want: auto obj = new Obj(); foreach (key, value; obj) { ... } Do I need to implement a interface someting like that? EDIT: The solution: p...

Fast vector struct that allows [i] and .xyz-operations in D?

I'd like to create a vector struct in D that works like this: vec u, v; vec w = [2,6,8]; v.x = 9; // Sets x v[1] = w.y; // Sets y u = v; // Should copy data Later I'd also like to add stuff like u = v * u etc. But the above will do for now. This is how far I've come: struct vec3f { float[3] data; alias data this; @propert...

What is D's version of C++'s system function?

How do I execute a command in the system shell in D (preferably Tango)? ...

Passing auto typed vars to function in D?

This doesn't work in D: void doSomething(auto a, auto b){ // ... } I'm just curious, will this ever work? Or is this just technically impossible? (Or just plain stupid?) In anyway, can this be accomplished in any other way? I suppose I could use the ... and look through the argument list, but I'm kinda making a library for lazy n...

Associative Array where a class TypeInfo is key in D?

I'd like to be able to create an multidim associative array where one dimension is a class. Like this: class Node{ Node[?classType?][string] inputs; } so that I later can do Node[] getInputsOfType(?? aClass){ if(aClass in this.inputs) return this.inputs[aClass]; else return null; } // meanwhile in another file....

determine CPU architecture in D

I have a C header file (it's a part of some SDK) and there is a typedef which depends on system architecture (whether it is 32 or 64-bit), how do I transfer it to my D module? Thanks. Edit: OK, that was too simple and I've already find a solution... If someone interested, it is: version(X86) { typedef int your_type; } version(X86_64...

Compile out code for release build in D

Is there any mechanism in D (D2) to force code to be compiled out during a release build? In C, you might have something like #ifndef NDEBUG /*Something that will only run in a debug build*/ #endif I know that D has debug(mymodule) { //Do something } But this requires the user to pass -debug for each module to enable it. I'm l...

Error: null dereference

This code: int main(char[][] args) { MyObject obj; obj.x; return 0; } gives me: Error: null dereference in function _Dmain when I compile it with -O flag (on dmd2) Why? Isn't obj allocated on the stack? Should I always use new to create objects? ...

"Independent" GUI window launching

I'm fairly new to GUI programming and I'm trying to write a plotting lib in D to use with some otherwise console-based scientific apps. I'm using DFL as my GUI library. Assume my plot form has a method called showPlot() that's supposed to display the plot on the screen. I would like to be able to have any thread in my app throw up a p...

What are the current challenges of the D programming language?

I'm wondering how mature and stable D is, and if it might be a good replacement for C/C++. I know that there are currently two standard libraries (Phobos and Tango), so I assume that there might be people trying to unify them. Additionally I heard some time ago that the languages has problems on the boundaries of GCed/non-GCed code. I ...

Most efficient portable overflow detection?

Possible Duplicate: multiplication of large numbers, how to catch overflow In close to the metal languages like C, C++ and D, what's the most efficient reasonably portable way (i.e. w/o using assembler, though you may assume two's complement arithmetic and wrap-around behavior) to detect overflow of an unsigned 64-bit integer ...

Using Winelib to port a Windows-only GUI toolkit

I love just about everything about the DFL GUI toolkit for D except that it only works on Windows because it's basically a pretty, high-level wrapper around the Windows API. How hard would it likely be to simply port such a toolkit to Linux (I don't really care about any other OS besides Windows and Linux) using Winelib? What are the o...

What is 'D' programming language?

What is 'D' programming language? People started developing application using this language? who found? Can I know more about this new programming language? ...