Consider:
% cat x.c
#include
uintptr foo[3];
uintptr bar=&foo[2];
% 8c -c x.c # this works.
% 5c -c x.c # this fails
x.c:3 initializer is not a constant: bar
If I change the last line to
uintptr* bar=&foo[2];
Both compilers compile it fine. But if I change the last line
to
uintptr ba
"6.6 Constant expressions" doesn't allow a cast from a non-arithmetic type
to an arithmetic one generally, and a cast
in an address constant can only cast from an integer constant to a pointer
type (eg, char *reg = (char*)0x123450);
the one example with 8c escaped with a warning ("initialize point
On Aug 1, 2018, at 4:35 PM, Charles Forsyth wrote:
> even so, the format and intention of the example seems practical (with the
> correct cast to uintptr) and "An implementation may accept other forms of
> constant expressions".
> it should be fairly easy to add as an extension with consistent