C tips (again)

bearophile bearophileHUGS at lycos.com
Fri May 1 16:56:05 PDT 2009


Walter Bright:
>Why couldn't you do the exact same thing in D?<

Those ctips show some tricks done with the preprocessor that I don't know yet how to do with D1, and there are some situations where in D I'd like to be able to locally disable array bound checks (this is doable in Delphi/FreePascal), like in the data array here:

typedef struct {
    int size;
    int capacity;
    char data[0];
} Mystring;

But D is more or less a superset of C, so a D programmer may be able to implement all those things, as you say.
The main point of my original post is that some of those ctips may be added as built-in idioms to D.

Regarding possible things to be added to D: recently I have heard that some people is thinking about creating a small C compiler that supports some nonstadard low-level features, to be used to compile the future Linux kernel:
http://lkml.org/lkml/2009/4/22/78
If such project goes on, then it may show other things that may be useful in D if D wants to be fit to write kernels too.

Bye,
bearophile



More information about the Digitalmars-d mailing list