constant expressions

diamond@tkovoa diamond at tkou02.enet.dec.com
Fri Aug 17 11:37:43 AEST 1990


In article <1990Aug16.152345.29177 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <1924 at tkou02.enet.dec.com> diamond at tkou02.enet.dec.com (diamond at tkovoa) writes:
>>Besides clearly NOT REQUIRING translation-time evaluations, I have also seen
>>clear REASONS for this non-requirement.  If your target machine can handle
>>128-bit ints, your host machine is not required to provide a simulator.
>Given that the compiler is required to do type checking (must produce a
>diagnostic for a violation of the rules), it's going to have to evaluate
>constant expressions as subscripts in array declarations.

Section 3.5.4.2 has a SEMANTICS rule about compatible array types.
I cannot find a similar CONSTRAINTS rule.  Therefore it seems that the
compiler is permitted but not required to do this type checking, and
is not required to produce a diagnostic for a violation.

>Provided it can get exactly the same effect, which is going to be tricky.
>The *preprocessor* is not required to emulate target arithmetic, but the
>rest of the compiler is nailed down pretty strictly.

The rest of the compiler is nailed down IF IT CHOOSES to compute
constant expressions.  It can always choose to leave a computation for
execution time.
-- 
Norman Diamond, Nihon DEC     diamond at tkou02.enet.dec.com
This is me speaking.  If you want to hear the company speak, you need DECtalk.



More information about the Comp.std.c mailing list