bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $((expr)) allows the hexadecimal constant "0x"


From: Chet Ramey
Subject: Re: $((expr)) allows the hexadecimal constant "0x"
Date: Thu, 29 Jun 2023 15:10:37 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

On 6/29/23 5:45 AM, Denys Vlasenko wrote:
Good day.

IIRC bash used to allow numeric constants of the
BASE#DIGITS form even if the DIGITS part was empty.
IOW: not only "64#0", but "64#" too was accepted
as a valid zero constant.

Yes, that was clearly wrong, and it changed in bash-5.1.

However, a somewhat similar situation with hex prefix,
0xDIGITS, still allows just "0x" as a valid zero constant.

That's clearly invalid as well. It violates the C standard, and POSIX
disallows it. No other shell treats it as valid. I suppose we could call
it an extension, but it's hard to see how it's useful.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]