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: Matthew Woehlke
Subject: Re: [Fwd: [PATCH] arithmetic -> logical shift]
Date: Mon, 27 Oct 2008 13:37:52 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.16) Gecko/20080723 Fedora/2.0.0.16-1.fc9 Thunderbird/2.0.0.16 Mnenhy/0.7.5.0

Pádraig Brady wrote:
Also arithmetic right shift is not useful.

While SAR (shift arithmetic right) is technically redundant with IDIV (integer divide), it's important in C programming where it is often used as an optimized special case of the latter. While this may not be especially important in shells, I'd be willing to argue that there is value in doing the same operation that C programmers expect.

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

Isn't the behavior of the C >> operator well-defined on signed integer types by the C standard? I would have expected that it is, and I would expect that defined behavior to be SAR, for the previously-mentioned reason.

I would reiterate Chet's suggestion that you ask the Austin Group for clarification if you wish to continue this discussion.

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
When on POSIX, do as POSIX mandates.





reply via email to

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