This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: A
- From: "Timothy C Prince" <tprince at myrealbox dot com>
- To: wg_nwpu at yahoo dot com dot cn
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 31 Jul 2006 15:36:03 +0000
- Subject: 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