On 2005-04-27 15:26:39 +0200, Gabriel Dos Reis wrote:
> Vincent Lefevre <[EMAIL PROTECTED]> writes:
> 
> | On 2005-04-27 03:37:15 -0700, Zack Weinberg wrote:
> | > Vincent Lefevre <[EMAIL PROTECTED]> writes:
> | > > However it is correct to store any integer to an unsigned variable,
> | > > even if the original value cannot be represented.
> | > 
> | > If that operation occurs at runtime it has a well-defined result.
> | 
> | And gcc 4 doesn't output a diagnostic in this case?
> 
> Why shall it?

No reason. I was just asking for a confirmation (I don't have gcc 4
here yet).

> In my version of the C standard, 6.6 contains *at least* these two
> constraints
>        Semantics
> 
>        [#5] An expression that evaluates to a constant is  required
>        in  several contexts.  If a floating expression is evaluated
>        in the translation environment, the arithmetic precision and
>        range  shall  be at least as great as if the expression were
>        being evaluated in the execution environment.
> 
>        [#6] An integer constant expression96)  shall  have  integer
>        type   and   shall  only  have  operands  that  are  integer
>        constants,  enumeration  constants,   character   constants,
>        sizeof  expressions whose results are integer constants, and
>        floating constants that are the immediate operands of casts.
>        Cast  operators in an integer constant expression shall only
>        convert arithmetic types to integer types, except as part of
>        an operand to the sizeof operator.
> 
> Clearly, 6.6/6 rules out AAA from being an integer constant.

It rules out AAA from being an integer constant expression.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Reply via email to