bug-bash
[Top][All Lists]
Advanced

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

Re: [Fwd: [PATCH] arithmetic -> logical shift]


From: Pádraig Brady
Subject: Re: [Fwd: [PATCH] arithmetic -> logical shift]
Date: Tue, 21 Oct 2008 12:10:30 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Chet Ramey wrote:
> 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.

Well that means the result is compiler dependent.
So scripts could give different results on another
platform, or less often within a platform.

Also arithmetic right shift is not useful.

Pádraig.





reply via email to

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