This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: signed is undefined and has been since 1992 (in GCC)
On Tue, Jun 28, 2005 at 08:57:20AM -0400, Robert Dewar wrote:
> But the whole idea of hardware semantics is bogus, since you are
> assuming some connection between C and the hardware which does not
> exist. C is not an assembly language.
A non-negligible part of the use of C and even C++ is as a high-level,
somewhat portable assembly language. Ignoring that part is not a very
good idea.
In particular, a very large number of C and C++ programs are written
with the assumptions:
- signed and unsigned types are modulo, except in loop induction
variables where it's bad taste
- sizeof(int) == 4, sizeof(long long) == 8
- sizeof(long) == sizeof(void *) == sizeof(void (*)())
Break them and see your compiler rejected by pretty much everybody.
OG.