[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $((expr)) allows the hexadecimal constant "0x"
From: |
Zachary Santer |
Subject: |
Re: $((expr)) allows the hexadecimal constant "0x" |
Date: |
Mon, 11 Dec 2023 07:49:08 -0500 |
On Sun, Dec 10, 2023 at 3:56 PM Chet Ramey <chet.ramey@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.
Sorry if that's already been done under the devel branch. I didn't
really get that vibe.
- Zack
Re: $((expr)) allows the hexadecimal constant "0x", Chet Ramey, 2023/12/11
Re: $((expr)) allows the hexadecimal constant "0x", Chet Ramey, 2023/12/11
Re: $((expr)) allows the hexadecimal constant "0x", Chet Ramey, 2023/12/10
Re: $((expr)) allows the hexadecimal constant "0x", Chet Ramey, 2023/12/10
- Re: $((expr)) allows the hexadecimal constant "0x",
Zachary Santer <=
Re: $((expr)) allows the hexadecimal constant "0x", Martin D Kealey, 2023/12/11