Re: [PATCH] C undefined behavior fix

Momchil Velikov
2002-01-03T16:50:09Z

>>>>> "Edgar" == Edgar Toernig <froese@gmx.de> writes:

Edgar> David Woodhouse wrote:
>>
>> What part of 'undefined behaviour' is so difficult for people to understand?

Edgar> The behaviour is undefined by the C standard. But the mentioned
Edgar> pointer arithmetic is defined in the environment where it has been
Edgar> used. GCC tries to optimize undefined C-standard behaviour. And
Edgar> IMHO that's the point. It may optimize defined behaviour and should
Edgar> not touch things undefined by the standard.

How do you imagine that "not touch" ? like "#if 0 ... #endif" ?

Edgar> PS: Hey, we are talking about C, the de luxe assembler! *g*

Standard is a standard. Broken code is broken code. Sometimes you can
get away with it, sometimes you can't and when you can't you fix the
code. Or define your own standard and make a compiler implementing
it.