comp.lang.c
[Top] [All Lists]

Re: Strange bit shifting result with gcc - am I missing something obvio

Subject: Re: Strange bit shifting result with gcc - am I missing something obvious?
From: Boltar
Date: Sun, 30 Mar 2008 13:50:16 -0700 PDT
Newsgroups: comp.lang.c

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. I'd have thought a value of zero would be the
obvious default for this sort of thing , after all languages like C
are supposed to shield us from the specifics of CPU instruction
behaviour otherwise we might as well just code in assembler!

B2003


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy