--- Comment #15 from 2010-11-27 14:25:07 PST ---
(In reply to comment #14)
> Let's give it a hope. Facts and reason do have to carry some weight. I'll
> commit octal to Phobos.

Even MISRA C disallows octal constants. They are useful only in special
situations. If Walter can't accept the idea of removing them from D, then an
alternative idea is to use a strategy inspired by how GCC deals with trigraphs.
This is a C program:

#include "stdio.h"
int main() {
    return 0;

If I compile it with GCC 4.5 I receive:

...>gcc tritest.c -o tritest
tritest.c: In function 'main':
tritest.c:3:11: warning: trigraph ??- ignored, use -trigraphs to enable


But a compiler switch enables them:

...>gcc -trigraphs tritest.c -o tritest


A similar compiler switch like "-octals" may enable octal number syntax in D.

But the idea of numerical constants that change value according to a compiler
switch is bad, so I don't want a warning. So a better idea is to turn integral
literals that start with one zero into true syntax errors, unless the "-octals"
switch is used.

This is useful also because turns standard C syntax (octals) into a syntax
error, instead of turning them silently into different values. This follows the
D design strategy of behaving (almost everywhere) like C where the C syntax is
accepted by the D compiler and producing a syntax error otherwise.

(This is not a tidy solution, but keeping some backwards compatibility with C
often asks for not tidy workarounds).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to