Date:        Tue, 27 Jun 2023 09:41:02 +0100
    From:        "Geoff Clare via austin-group-l at The Open Group" 
<austin-group-l@opengroup.org>
    Message-ID:  <ZJqgnkTO1n2erQin@localhost>

  | Yes, via XCU 1.1.2; the C standard allows it for signed long, so it's
  | allowed for anything that 1.1.2 requires to be "equivalent to the
  | ISO C standard signed long data type".

And of course, that means that even though the >> operator is in Table 1-2
as one that must be supported, it cannot actually work, as >> is unspecified
(or even undefined, I forget) on signed values, and POSIX sh arithmetic only
allows for signed values.   << may have similar issues (at least some compilers
are starting to complain about the use of << with a signed left operand, which
I am guessing means at least some version of the C standard has made that be
unspecified/undefined as well).

The implementation I work with ignores that, and when an operation works
better with unsigned operands, it simply treats them as unsigned instead
of signed.   I suspect other shells might do the same.

kre

  • out-of-bounds numbers... Thorsten Glaser via austin-group-l at The Open Group
    • Re: out-of-bound... Geoff Clare via austin-group-l at The Open Group
      • Re: out-of-b... Thorsten Glaser via austin-group-l at The Open Group
        • Re: out-... Geoff Clare via austin-group-l at The Open Group
        • Re: out-... Robert Elz via austin-group-l at The Open Group
          • Re: ... Gabriel Ravier via austin-group-l at The Open Group
          • Re: ... Thorsten Glaser via austin-group-l at The Open Group

Reply via email to