Topic: behaviour formed ill no diagnostic shall should undefined (Was: ++var)
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/09/21 Raw View
Roman Belenov wrote:
> SC> But that expectation is not justified. "Undefined behavior" means
> SC> the standard places NO requirements on the implementation. Any
> SC> result, including "-1", "42", a refusal to compile, or a run-time
> ^^^^^^^^^^^^^^^^^^^^
> SC> abort, is allowed.
>
> IMHO this particular behaviour is not standard - the code must be
> compiled, even though the resulting binary may destroy the Earth.
You are basically right, but the whole thing (ill-formed
vs well-formed vs shall vs should vs no diagnostic, undefined
vs unspecified, text vs example vs notes vs foonotes vs text
``noting'' something, ...) is a mess.
There are actually two very different kinds of undefined behaviour:
- compile time; ex. ODR
- run time; ex. 1./0
Only the first kind may halt the compilation. It is often
(not always !) called ``ill-formed''. ``shall'' is even
more funny. I don't even want to consider ``should'' here.
Common sens may help. It seems that you have it.
--
Valentin Bonnard
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]