01777777777777777777777 [std.conv.octal]

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 7 15:01:02 UTC 2022


On 4/7/22 10:00 AM, kdevel wrote:
> The documentation does not explicitly mention the inherent 
> limitation of the quoteless conversion. The two forms 
> ``octal!<literal>`` and ``octal!<literal>"`` are treated as 
> interchangeable.

`octal!123` is a template, and as such, must be valid D code. Your 
integer is not valid D code, so it doesn't compile. That doesn't mean it 
won't compile for valid integers.

The string version is guaranteed to work, as long as the resulting 
number fits, which is why it should be suggested by the compiler. But 
removing the support for regular integers isn't necessary.

A spec documentation update would be good too.

And OMG, that implementation for the non-string version is terrible, we 
should not be doing that for CTFE.

-Steve


More information about the Digitalmars-d mailing list