reddit discussion on article by bearophile

Kagamin spam at here.lot
Wed Nov 16 10:34:36 PST 2011


Andrei Alexandrescu Wrote:

> http://www.reddit.com/r/programming/comments/me6a5/some_examples_of_strong_static_typing_in_d/
> 
> Andrei

Those are examples of shitty C coding... if I wanted something akin to what he wrote I'd do this

#define ENTRY(name, val) { (1<<val), #name },

then do

struct {
    unsigned long val;
    const char *name;
 } entries[] = {
   ENTRY(0, yellow)
   ENTRY(1, blue)
   ...
 };

Haha... He's unlucky if this compiles (and it can).


More information about the Digitalmars-d mailing list