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: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Olivier Galibert'" <galibert at pobox dot com>,"'Andrew Haley'" <aph at redhat 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 18:36:26 +0100
- Subject: RE: signed is undefined and has been since 1992 (in GCC)
----Original Message----
>From: Olivier Galibert
>Sent: 28 June 2005 18:18
> On Tue, Jun 28, 2005 at 04:03:49PM +0100, Andrew Haley wrote:
>> Olivier Galibert writes:
>> > 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++.
>>
>> This is childish and insulting.
>
> Calling a large part of the programs out there, including a non
> negligible subpart of what I personally write either "blatantly buggy"
> or "subtly-incorrect" is somewhat childish and insulting.
It certainly wasn't meant to be. It was meant to be a dispassionate
description of the state of facts. Software that violates the C standard
just *is* "buggy" or "incorrect", and your personal pride has absolutely
nothing to do with it.
If you re-read what *you* originally said, you made it look like you were
talking in abstract terms about software-in-general, and that's certainly
what I was referring to when I replied; it's unreasonable of you to point at
that very generalised sentence and suddenly say "I was talking about my own
code, even though I hid the fact, and so you've insulted me by disparaging
it".
> Lemme give the long version then.
No number of correct assumptions about the sizes of various types or the
representation of NULL pointers will validate the incorrect assumption that
signed integer arithmetic could be made to wrap without obliging the
compiler to emit lousy code and miss an awful lot of loop-optimisation
opportunities.
cheers,
DaveK
--
Can't think of a witty .sigline today....