[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Meeting the Scope and Purpose of P754
On 2007-07-18 09:22:25 +0100, Nick Maclaren wrote:
Yes, but it manages to make even that seriously ambiguous. 6.3.1.5
says:
If the value
being converted is in the range of values that can be
represented but cannot be represented exactly, the result is
either the nearest higher or nearest lower representable
value, chosen in an implementation-defined manner. If the
value being converted is outside the range of values that
can be represented, the behavior is undefined.
As usual with the C standard, there is no hint anywhere of which
section takes precedence over which, and so it is perfectly reasonable
to interpret this as overriding Annex F.
It is reasonable to consider that Annex F takes the precedence
(it can be seen as additional constraints, so that an undefined
or implementation-defined behavior can become defined). This is
more or less what the end of F.1 badly says.
There is an even more horrible problem, which is that C99 does
not define what it means by type in the specification of casts and
assignments. Again, it is reasonable to interpret it as meaning
syntactic type, so the value need not be converted provided that
it is treated as if it were a value of another type.
C99 says "semantic type". See also 6.3.1.8#2 and its note about cast
and assignment operators.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)