But why should the result be an unportable/undocumented parrot op? If parrot's aiming for portability, so long as external libraries aren't used, shouldn't parrot treat code the same way for all platforms? Otherwise, each compiler for parrot would have to add in code to find out the size of int, and handle it to provide an expected result. Wouldn't that just be too much duplication of code?

On Nov 4, 2005, at 4:17 AM, Leopold Toetsch wrote:


On Nov 4, 2005, at 1:26, Luke Palmer wrote:

On 11/3/05, Leopold Toetsch <[EMAIL PROTECTED]> wrote:

Shifting anything by >= the bits of the int isn't portable nor
specified.

Why isn't it specified?  It seems to me that it should be zero.

C standard (actually from a draft of C99)

If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined.

amd3-24594.pdf (AMD x86-64 Architecture Programmer’s Manual)

The processor masks the upper three bits of the count operand, thus restricting the count to a number between 0 and 31. When the destination is 64 bits wide, the processor masks the upper two bits of the count, providing a count in the range of 0 to 63.

Luke

leo


Reply via email to