Re: FW: Is it a bug when use “<<”if the operator is out of the size "0~63"

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

 



On Fri, Feb 24, 2012 at 7:49 PM, Yang Yueming <yueming.yang@xxxxxxxxxx> wrote:
>
>
> -----Original Message-----
> From: Yang Yueming
> Sent: Friday, February 24, 2012 4:35 PM
> To: gcc@xxxxxxxxxxx
> Subject: Is it a bug when use “<<”if the operator is out of the size "0~63"
>
> Case:
> #include <stdio.h>
> #include <stdlib.h>
>
> long long abc = 0x01234567891abcde;
>
> long long xyz;
>
> int main ()
> {
>
>        xyz = abc << 65;
>
>        printf("%llx\n", xyz);
>
>        return 0;
>
> }
>
>
>
>
> The result of xyz should be "0",but it is "2468acf123579bc" ,same as  xyz = abc << 1,Why?
>
> So as for "int a<<35"and etc..
Not sure if its a bug, but its illegal in C++.

ARM behave totally different than x86. I don't recall the details
though, but you don't arrive at an expected value to tricks played
with the bits.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux