Re: A

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

 




-----Original Message-----
From: bacmoz <wg_nwpu@xxxxxxxxxxxx>
	a = 1<<(8 * sizeof(unsigned long long) - 1);			//	here give a warning
i don't know why i cannot get 1<<63 in my c program.

if change the type "unsigned long long" to "unsigned int", the result is ok.
_________________________________________________--
Perhaps you mean to use a constant of some type other than int, such as 1LL.  The result of shifting an int (32 bits on your platform) by 63 bits is hardware dependent, so gcc warns you.  I know you meant the code to be platform dependent (e.g. by assuming 8 bits per byte), but gcc wants to help you anyway.

Tim Prince


[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