Walter Bright Wrote:

> Adam D. Ruppe wrote:
> > The argument most often brought up for keeping octal *at all* is unix
> > filesystem permissions. They are only ever as big as four digits (AFAIK).
> 
> There is one other reason: converting C code to D code. This should follow 
> the 
> principle of "if it doesn't give a compiler error, it should produce the same 
> result". Translating:
> 
>     0177
> 
> in C to:
> 
>     0177
> 
> in D will silently produce a very different result (should such a number be 
> decimal).

How about a command line argument to DMD which can be used to aid in porting 
legacy C code? It would cause the compiler to generate a warning (or error if 
you wish) for every occurrence of an ambiguous construct like this. Once all 
such cases have been converted to valid D code and the code compiles without 
warnings, the command line argument can be dropped.

This allows D to escape from the C compatibility trap which has encumbered C++ 
so much while still giving safety against subtle bugs while porting old code.

Reply via email to