Denis Koroskin wrote:
On Fri, 21 Nov 2008 19:19:58 +0300, Tom S <[EMAIL PROTECTED]> wrote:

bearophile wrote:
6) Static if and static asserts seem a little more complex that the ways to do similar things in C, but they seem a good complexity.

Static if and static asserts in C? Good joke.


No kidding:

#define STATIC_ASSERT(expr) typedef char __staticAssert[ (expr) ]

My point exactly *g* This one doesn't work. Arrays of 0 length are valid... You could subtract 1, but then, "STATIC_ASSERT(1); STATIC_ASSERT(2);" will fail anyway. Turns out one has to resort to a different _trick_. Then one compiler doesn't like it and you end up adding special cases. There goes "a little more complex that the ways to do similar things in C". Oh wait a sec, similar? I think he meant similar to the D stuff... How much of the D compile-time checking can you do in C then? :D And try a nice, formatted error message for the static assertion :P


--
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode

Reply via email to