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 02:52:10PM -0400, Robert Dewar wrote:
> Olivier Galibert wrote:
> >On Tue, Jun 28, 2005 at 06:36:26PM +0100, Dave Korn wrote:
> >
> >> 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.
> >
> >
> >Then your definition of "incorrect" is uninteresting.  Per your
> >definition, "use of implementation-defined behaviour is incorrect",
> >essentially no non-trivial program is correct.  Including gcc for a
> >start, which can't be correct, ever.
> 
> Nope, there is nothing in the C standard that suggests that a program
> relying on implementation-defined behavior is incorrect of buggy, and that
> has nothing to do with what Dave Korn wrote. There is a world of
> difference between undefined and implementation-defined.

Dave Korn wrote, in answer to a list of assumptions I wrote, that
"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!"

These assumptions were:
- signed and unsigned types are modulo, except in loop induction
  variables where it's bad taste (to rely on the overflow doing
  anything specific)

- sizeof(int) == 4, sizeof(long long) == 8

- sizeof(long) == sizeof(void *) == sizeof(void (*)())

Please tell me which of these assumptions are not
implementation-defined but instead undefined.

  OG.


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