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)
- From: Olivier Galibert <galibert at pobox dot com>
- To: Dave Korn <dave dot korn at artimi dot com>
- Cc: 'Robert Dewar' <dewar at adacore dot com>,'Gabriel Dos Reis' <gdr at integrable-solutions dot net>,'Andrew Pinski' <pinskia at physics dot uc dot edu>,'gcc mailing list' <gcc at gcc dot gnu dot org>
- Date: Tue, 28 Jun 2005 16:51:48 +0200
- Subject: Re: signed is undefined and has been since 1992 (in GCC)
- References: <20050628142441.GA52889@dspnet.fr.eu.org> <SERRANOQzV7r6pVu4Jb0000024f@SERRANO.CAM.ARTIMI.COM>
On Tue, Jun 28, 2005 at 03:39:38PM +0100, Dave Korn wrote:
> ----Original Message----
> >From: Olivier Galibert
> >Sent: 28 June 2005 15:25
>
> > In particular, a very large number of C and C++ programs are written
> > with the assumptions:
>
> This is a bad line of reasoning in general. There is a vast amount of bad
> software in the world, some blatantly buggy, some subtly-incorrect. To
> attempt to fix it all in the compiler rather than the source seems a bit
> bass-ackwards to me!
Welcome to the real world. Useful compilers are not an exercise in
theorical computing, especially for languages like C or C++.
> > - sizeof(int) == 4, sizeof(long long) == 8
> >
> > - sizeof(long) == sizeof(void *) == sizeof(void (*)())
> >
> > Break them and see your compiler rejected by pretty much everybody.
>
> And what about 64 bit architectures? Your assumptions are already widely
> invalid and only going to get more so.
They aren't. They have:
- sizeof(int) == 4, sizeof(long long) == 8
- sizeof(long) == sizeof(void *) == sizeof(void (*)()) == 8
and nobody in his right mind would seriously propose to change
sizeof(int) to 8 or sizeof(long long) to 16.
IA-64 may have an issue with sizeof(void (*)()) from what I've heard,
but they have been laughed out of the market.
OG.