This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: portable signed right shift


dewar@gnat.com wrote:
> 
> >-1 >> 1 = -1  (where >> denotes an arithmetic shift right)
> 
> Note however, that there is nothing in the definition of C that says
> that -1 >> 1 = -1. This is just one possible convention of what you might
> expect this undefined operator to do.

There's nothing in the definition of C that says that -1 / 2 = 0 either,
for that matter.

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
        "Hungarian notation is the tactical nuclear weapon of
         source code obfuscation techniques." -- Roedy Green


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]