[Issue 19059] Invalid integer literal 08 and 09 allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 4 23:23:51 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19059

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
Per the spec [1], `01` through `09` are all invalid since octal literals are
gone. They all have obvious values, though. Which is probably why they've been
kept around.

I see three ways forward:

1) Outlaw `01` through `09`. This would break existing code.

2) Let all literals that start with zero be decimals instead of octals. `01`
would be 1, `08` would be 8, `000123` would be 123. This would break the rule
that C code should either behave the same or fail compilation in D.

3) Allow only `01` through `09` as decimal literals. Not elegant, but it might
be the best option.


[1] https://dlang.org/spec/lex.html#DecimalInteger

--


More information about the Digitalmars-d-bugs mailing list