Hello,
I wrote this:
#define M(x) enum { m##__LINE__ = x };
#line 1000
M(126)
M(341)
M(565)
...
expecting the preprocessor to build
enum { m1000 = 126 };
enum { m1001 = 341 };
enum { m1002 = 565 };
...
but instead got
enum { m__LINE__ = 126};
enum { m__LINE__ = 341};
enum { m__LINE__ = 565};
...
which of course did not copile.
Is there any solution to produce the expected result,
without entering the a sequence like 1000 1001 1002.. ?
I tried
#define M(l,x) enum { m##l = x };
#line 1000
M(__LINE__,126)
M(__LINE__,341)
M(__LINE__,565)
...
and similarly failed.
Note: I do not want to put these values into an array; I want
them as enum, which allows me to sort them using the compiler
with a sorting network, rather than at runtime.
TIA,
François Grieu