| Subject: | Re: Strange bit shifting result with gcc - am I missing something obvious? |
|---|---|
| From: | Eric Sosman |
| Date: | Sun, 30 Mar 2008 17:18:33 -0400 |
| Newsgroups: | comp.lang.c |
Boltar wrote: On 30 Mar, 21:37, jacob navia <ja...@xxxxxxxxxx> wrote:The result of shifting more than sizeof(int)*CHAR_BIT positions is NOT defined by the language. It is an illegal expression.It isn't? Thats bloody annoying since that means i'll have to do a specific check for the bit shift count being > than the size of the type being shifted.
Actually, you need to check for >=, not just >. And
with signed integers, you need to be sure the value being
shifted is non-negative and small enough that no 1's are
propagated into the sign position.
--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxxx
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: creating a testfile for catv, Keith Thompson |
|---|---|
| Next by Date: | Re: Strange bit shifting result with gcc - am I missing something obvious?, Keith Thompson |
| Previous by Thread: | Re: Strange bit shifting result with gcc - am I missing something obvious?, Boltar |
| Next by Thread: | Re: Strange bit shifting result with gcc - am I missing something obvious?, lawrence . jones |
| Indexes: | [Date] [Thread] [Top] [All Lists] |