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]
Other format: [Raw text]

Re: signed is undefined and has been since 1992 (in GCC)


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.


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