On 12/11/23 7:49 AM, Zachary Santer wrote:
On Sun, Dec 10, 2023 at 3:56 PM Chet Ramey <chet.ra...@case.edu> wrote:
Come on. Bash (and POSIX) define arithmetic in terms of how C does it,
and that is an invalid C integer constant. It's not even shell-specific
syntax like base#number; it's something that C defines. Is it worth it
trying to be helpful, or is it better to follow the standard you say you
do?

Just so everyone's clear:

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: msys
Compiler: gcc
Compilation CFLAGS: -march=nocona -msahf -mtune=generic -O2 -pipe
-D_STATIC_BUILD
uname output: MINGW64_NT-10.0-19045 Zack2021HPPavilion 3.4.10.x86_64
2023-11-30 06:09 UTC x86_64 Msys
Machine Type: x86_64-pc-msys

Bash Version: 5.2
Patch Level: 21
Release Status: release

$ printf '%s\n' "$(( 0x ))";
0

In my opinion, it would be better to have this not treated as valid,
for the same reason that 10# is no longer treated as valid. And it
would probably do less script-breaking than invalidating 10# did.

It's still accepted in the devel branch, unless STRICT_ARITH_PARSING is
defined. There was a discussion about it in 2022:

https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00045.html

in the context of the bash arithmetic parser trying to be too helpful.
It's clearly invalid, and no one should be using it.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to