Void-safety (and related things)

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri Aug 21 10:52:33 PDT 2009


On Fri, Aug 21, 2009 at 12:58 PM, bearophile<bearophileHUGS at lycos.com> wrote:
> Joel C. Salomon:
>
>>http://plan9.bell-labs.com/sys/doc/comp.html<
>
> Thank you for that link.
> I can see some interesting things in that very C-like language:
>
>>The #if directive was omitted because it greatly complicates the preprocessor, is never necessary, and is usually abused. Conditional compilation in general makes code hard to understand; the Plan 9 source uses it sparingly. Also, because the compilers remove dead code, regular if statements with constant conditions are more readable equivalents to many #ifs.<
>
> Can the "static if" be removed from D then?

No.  Not only can 'static if' appear where 'if' can't (like at module
scope and inside templates), it also does not create a scope unlike a
normal 'if'.  They're similar, but different enough to warrant being
different constructs.

> Variables inside functions can have any order, are D compilers too doing this?

None currently do, but I think it's allowed by the D spec.  Please
don't go beg the LDC developers for this as soon as you read this.
They really do have better things to do.



More information about the Digitalmars-d mailing list