Re: [RFC] Add support for explicit octal notation for integer literals
| From: | G. P. B. | Date: | Tue, 03 Nov 2020 19:18:32 +0000 |
| Subject: | Re: [RFC] Add support for explicit octal notation for integer literals | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112164@lists.php.net to get a copy of this message | ||
On Wed, 21 Oct 2020 at 16:56, Eugene Sidelnyk <zsidelnik@gmail.com> wrote:
> What is the practical use case for this. I think it will make code a bit
> more confusing
>
> On Wed, Oct 21, 2020, 5:59 PM G. P. B. <george.banyard@gmail.com> wrote:
>
>> Hello internals,
>>
>> A rather short RFC about adding support for the "0o" prefix for octal
>> integers.
>> https://wiki.php.net/rfc/explicit_octal_notation
>>
>> Surprisingly PHP already accepts the prefix within octdec() and
>> base_convert().
>>
>> I have hopefully covered all the cases where this may apply but if you
>> find
>> another one please let me know.
>>
>> Best regards
>>
>> George P. Banyard
>>
>
Please send all replies to the list as no one else can see them.
(And please don't top post).
I don't understand how this can be *more* confusing than:
014 evaluating to 12 because it's interpreted as an octal.
The point is to make it explicit that it's an octal number in the same way
we have
0x1A = 26 for hexadecimal numbers, and similarly 0b prefix for binary
integer literals.
Regards,
George P. Banyard