On 11/16/11 10:34 AM, Kagamin wrote:
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).

Heh heh... took me a few seconds to figure out what you meant.

Andrei

Reply via email to