Octal literals: who uses this?

Christopher Wright dhasenan at gmail.com
Sat Mar 14 06:13:03 PDT 2009


I've been looking at dil and lexing D. Lexing character literals and 
string literals is not quite so easy as I thought it would be, but 
overall not difficult either.

One thing I'm curious about:
There are three forms of hex literals:
\x: 2 digits
\u: 4 digits
\U: 8 digits

There is one form of octal literal:
\: 1 to 3 digits

Why? With hex literals, each option is a fixed width. That is sensible.

Octal literals aren't necessary with hex literals, but they might be 
convenient. However, making them variable width seems like it opens up 
the possibility for obscure bugs. I would not recommend that anyone use 
octal literals, and I don't think they're an advantage to the language. 
Even if they were, their current representation is not.

Can we just remove this?



More information about the Digitalmars-d mailing list