This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A



-----Original Message-----
From: bacmoz <wg_nwpu@yahoo.com.cn>
	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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]