[Ilugc] Re: Regarding gcc compiler in Linux

  • From: vivekanathan@xxxxxxxxx (Vivek)
  • Date: Tue Mar 1 22:40:11 2005

You are trying to shift the bits greater than the width of the datatype.
Try with
'long long int' which is of size 64 bits.



On Tue, 01 Mar 2005 20:15:41 +0530, Vijairaj R
<vijairaj_sr@xxxxxxxxxxxxxx> wrote:

Sangharsha p g wrote:

   unsigned int a=0xffffffff;
   unsigned int b=a<<32;

The expected value of b should be 0 but it is displaying something else.

gcc is smart. The value of b is undefined if the right operand
of shift is greater than or equal to the number of bits of the
promoted left operand.

--
Regards,
R Vijairaj

Jai Jawan! Jai Kissan! Jai FSFn!

_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc



-- 
Vivek

Other related posts: