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



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
.



Relevant Pages

  • Re: Whats the next paradigm shift?
    ... This isn't a paradigm shift in exactly the Kuhn meant, ... we cannot speak about it. ... There is no common language. ...
    (rec.org.mensa)
  • Re: << and >> operators in c#
    ... of the array ... the general rule being: ... And what language might that be defined in? ... I think it makes a poor bit shift because it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Shift em bits
    ... The language won't allow it. ... Shift operators only apply to integer ... you might find that you have defined an "8 uchar array" as your ... If you really are trying to write portable code (avoiding ASM for ...
    (comp.arch.embedded)
  • Re: NIP arrived.
    ... >> It really was a perfect example of how language is used to shift the ... >> responsibility away from the ones that fucked up. ... > junction manoeuvre you can encounter in terms of time spent at risk. ...
    (uk.rec.driving)
  • Re: Plausibility Check
    ... Just because a language has changed doesn't mean that the writing ... Some languages have relatively stable consonants over time, but shift ... vowels a lot, others have the reverse (Polynesian and Slavic ...
    (sci.lang)