[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: [PATCH] arithmetic -> logical shift]
From: |
Chet Ramey |
Subject: |
Re: [Fwd: [PATCH] arithmetic -> logical shift] |
Date: |
Sat, 18 Oct 2008 17:04:38 -0400 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Pádraig Brady wrote:
> -------- Original Message --------
> Date: Tue, 07 Oct 2008 11:55:51 +0100
> From: Pádraig Brady <P@draigBrady.com>
> To: Chet Ramey <chet.ramey@case.edu>
> CC: thockin@hockin.org
>
> I was just discussing bit shifting with Tim Hockin using shell
> arithmetic expansion, and he pointed out that bash and ksh
> use arithmetic rather than logical shift for the >> operator.
Actually, bash and ksh use whatever the native C compiler implements,
since both just translate the >> and << into the same operators
internally.
I don't see a really compelling reason to change, since, as you say,
the standard requires signed long ints.
> I know the opengroup spec says to use signed ints,
> but I think that is intended to disambiguate input and output,
> rather than defining internal operations.
You might send a message to the austin group asking for an opinion.
That would give you a better sense of the standard's intent.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/