01777777777777777777777 [std.conv.octal]
kdevel
kdevel at vogtner.de
Thu Apr 7 16:28:39 UTC 2022
On Thursday, 7 April 2022 at 15:01:02 UTC, Steven Schveighoffer
wrote:
> 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 was never disputed.
> That doesn't mean it won't compile for valid integers.
That was not my objection. My point is that it won't compile for
certain valid octal literals. Consider this implementation
```
template octal(ubyte decimalInteger)
{
enum octal =
octal!(typeof(decimalInteger))(to!string(decimalInteger));
}
```
Your argument applies to this code accordingly. But you would
certainly halt it in the code review. Does it really make a
qualitative difference if one writes ubyte or – as implicitly in
the current code – ulong?
Stefan
BTW: I haven't yet taken a peek into the C header inclusion
stuff. How are octal literals processed in that code?
More information about the Digitalmars-d
mailing list