[PATCH] C undefined behavior fix

Geoff Keating geoffk@geoffk.org
Mon Jan 7 15:41:00 GMT 2002


Linus Torvalds <torvalds@transmeta.com> writes:

> On Sat, 5 Jan 2002, mike stump wrote:
> >
> > We have a choice, the choice is to define it to render the expression
> > into the same category as the standard undefined behavior.
> 
> No, you don't have that choice.
> 
> And that's not just my opinion - see the independent posting by Zack
> Weinberg on an "unofficial ruling" by a member of the C standards
> committee on comp.std.c. (subject line: "May an implementation document
> implementation-defined behavior as undefined?")

Unfortunately, one member does not necessarily represent the
committee.

In fact, if you go around polling individual C committee members on
any really difficult question, typically you get all of the following
answers:

1. It's obvious, the answer is yes.
2. It's obvious, the answer is no.
3. It's so obvious, I don't need to say.
4. That's really hard, I don't know.

and in fact I suspect if you don't get at all the four answers, your
question is too easy :-).

> "implementation-defined" simply _cannot_ be "undefined". You get a choice,
> and the implementation has to document the choice.

Would it really help if someone made the huge effort and documented
what GCC really does?  Everything the user needs to know is already
documented: "don't do that".

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>



More information about the Gcc mailing list