Re: [PATCH] C undefined behavior fix

Laurent Guerby
2002-01-06T13:56:03Z

dewar@gnat.com wrote:

> A bit heavy, but yes, that's a trick that will work.

Well, the whole point of the exercise and discussion is how to
be heavy handed with the compiler so that it can't get away with
ignoring what the programmer asks even with a good language lawyer :).

If I followed correctly, language lawyer wins in C,
but not in Ada (but the developper can loose if the Ada compiler
just says the declaration is illegal :).

But even in the case of the compiler reading more (and writing anyway),
I think it is the compiler burden to prove that the extra stuff
"read" is not observable (in the sense of external
effect) at execution. In a memory-mapped I/O architecture
where there is a distinction on external effects between a byte read
and a word read (eg: a crash :), the compiler can't get very far IMHO
(if it accepts the declaration of course).

--
Laurent Guerby <guerby@acm.org>