This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: portable signed right shift
- To: fjh at cs dot mu dot oz dot au, jbuck at racerx dot synopsys dot com
- Subject: Re: portable signed right shift
- From: dewar at gnat dot com
- Date: Wed, 28 Mar 2001 23:30:16 -0500 (EST)
- Cc: gcc at gcc dot gnu dot org
<<Do you know of any C89 implementations for which integer division does not
truncate towards zero?
>>
It is unlikely at this stage. Historically there were machines on which
division truncated away from zero for negative numbers (the natural
mathematical definition where dividing by two divides numbers into
those with a remainder of 0 and those with a remainder of 1). For
example, the KDF-9 was like this (for sure), and I am fairly sure
the ICL series machines were also like this.
But Fortran required truncation towards zero, and with the supremacy of
Fortran over Algol in the commercial world, European machines fell in
line with US machines which had always truncated towards zero.
Note that thye question is not about C89 implementations but about machines,
if there *were* a machine with the old European definition, then the change
in C99 would be mega-painful :-)