This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Strange shifting behaviour
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Ulf Magnusson <ulfalizer at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 12 Jul 2005 17:45:59 -0500
- Subject: Re: Strange shifting behaviour
- References: <cf7bbda905071215342a025aba@mail.gmail.com>
Hi Ulf,
>When shifting an int by its size in bits...
That is undefined behavior (implementation dependent), as per C and C++ standards. Ever since C was first taking it's first baby steps.
By "undefined behavior", that means any given particular implementation can:
+ not do anything
+ do what you expect
+ SEGV
+ format your hard drive
--Eljay