jaime <no*********@example.orgwrites:
Hi again all.
Given the line:
const int x=5;
Can I then use "x" as a constant expression? (By "constant expression", I
mean "constant expression" as defined in the C99 standard)
Short: no.
Medium: not if you want portable code.
Long: read all of section 6.6 of the standard. The trouble is it says
what you *can* have. The value of a variable, const, or otherwise is
not one of these.
Section 6.6 does permit implementations to allow other forms, so you
might be able to do it, but your code will not be portable. Such am
implementation would be violating the spirit in which const was
introduced (to signify a read-only, run-time object).
--
Ben.