01777777777777777777777 [std.conv.octal]

kdevel kdevel at vogtner.de
Thu Apr 7 19:18:23 UTC 2022


On Thursday, 7 April 2022 at 16:38:58 UTC, Adam Ruppe wrote:
> On Thursday, 7 April 2022 at 16:28:39 UTC, kdevel wrote:
>> That was not my objection. My point is that it won't compile 
>> for certain valid octal literals.
>
> They're not actually octal literals.

You certainly don't want to dispute that

     01777777777777777777777

is actually an octal literal whose value fits in a ulong?

> The implementation is (ridiculously) overcomplicated - 
> ironically, as a result of code review nitpicking types - but 
> the concept isn't: it *pretends* it is an octal literal.

This concept is dubious and that is what bothers me.

> This is a convenience method

Made to save two keystrokes after having typed six additional 
ones compared to C/C++?

> that is not expected to work for all possible values, which is 
> why the string
> one exists.

The method does not work for most of the possible octal literals 
whose values fit in a ulong. I would call it an inconvenience 
method.


More information about the Digitalmars-d mailing list