L
Laurent Deniau
If I understand well, an enumeration is only garantee to hold at most an
int (6.7.2.2-2). So I would like to know:
how to store a long in an enum?
enum { p2_31 = 1L << 31 };
// boom
how to define a synonym of a constant address?
enum { p = (ptrdiff_t)&address_of_an_unknown_variable };
// boom, ptrdiff_t is generally of type long.
The important aspect is the constness since I would like to use the new
identifier to initialize static data. It is mainly the second case which
interests me, even if both are equivalent.
Note that I cannot use the preprocessor since my problem rises after the
cpp phase. This is why I don't know the variable identifier when I need
to take its address (but I know it when I can define the enum).
Thanks.
a+, ld.
int (6.7.2.2-2). So I would like to know:
how to store a long in an enum?
enum { p2_31 = 1L << 31 };
// boom
how to define a synonym of a constant address?
enum { p = (ptrdiff_t)&address_of_an_unknown_variable };
// boom, ptrdiff_t is generally of type long.
The important aspect is the constness since I would like to use the new
identifier to initialize static data. It is mainly the second case which
interests me, even if both are equivalent.
Note that I cannot use the preprocessor since my problem rises after the
cpp phase. This is why I don't know the variable identifier when I need
to take its address (but I know it when I can define the enum).
Thanks.
a+, ld.