This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: portable signed right shift
On 28-Mar-2001, Joe Buck <jbuck@racerx.synopsys.com> wrote:
> > On Thu, 29 Mar 2001, Ross Smith wrote:
> >
> > > There's nothing in the definition of C that says that -1 / 2 = 0 either,
> > > for that matter.
> >
> > C99 subclause 6.5.5 paragraph 6 and footnote 87.
>
> Right, but in C89 it is unspecified, meaning that it is not a safe
> assumption for a programmer to make.
Do you know of any C89 implementations for which integer division does not
truncate towards zero?
One of the reasons that the C99 committee was willing to tighten up the
specification here is that existing implementations were doing what C99
specifies anyway.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.