This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Compile time error



I have an array which is defined and initailized with:

------------
#ifdef _
# error Macro _ already in use
#endif
#define _(value)  (Float)(value##.L / 0x10000)

const Float  Di_opt [32] [16] = {
   { _(  0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _(  6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037),
   { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _(  5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063),
   { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _(  5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080),
   { _( -1), _( -38), _( 225), _( -645), _( 1893), _(-6237), _(  4561), _(-43006), _(74630), _(31947), _(8092), _( 4063), _(2087),
   { _( -1), _( -41), _( 227), _( -711), _( 1822), _(-6589), _(  3776), _(-44821), _(74313), _(30112), _(8492), _( 3705), _(2085),
   { _( -1), _( -45), _( 228), _( -779), _( 1739), _(-6935), _(  2935), _(-46617), _(73908), _(28289), _(8840), _( 3351), _(2075),
   { _( -1), _( -49), _( 228), _( -848), _( 1644), _(-7271), _(  2037), _(-48390), _(73415), _(26482), _(9139), _( 3004), _(2057),
   { _( -2), _( -53), _( 227), _( -919), _( 1535), _(-7597), _(  1082), _(-50137), _(72835), _(24694), _(9389), _( 2663), _(2032),
   { _( -2), _( -58), _( 224), _( -991), _( 1414), _(-7910), _(    70), _(-51853), _(72169), _(22929), _(9592), _( 2330), _(2001),
   { _( -2), _( -63), _( 221), _(-1064), _( 1280), _(-8209), _(  -998), _(-53534), _(71420), _(21189), _(9750), _( 2006), _(1962),
   { _( -2), _( -68), _( 215), _(-1137), _( 1131), _(-8491), _( -2122), _(-55178), _(70590), _(19478), _(9863), _( 1692), _(1919),
   { _( -3), _( -73), _( 208), _(-1210), _(  970), _(-8755), _( -3300), _(-56778), _(69679), _(17799), _(9935), _( 1388), _(1870),
   { _( -3), _( -79), _( 200), _(-1283), _(  794), _(-8998), _( -4533), _(-58333), _(68692), _(16155), _(9966), _( 1095), _(1817),
   { _( -4), _( -85), _( 189), _(-1356), _(  605), _(-9219), _( -5818), _(-59838), _(67629), _(14548), _(9959), _(  814), _(1759),
   { _( -4), _( -91), _( 177), _(-1428), _(  402), _(-9416), _( -7154), _(-61289), _(66494), _(12980), _(9916), _(  545), _(1698),
   { _( -5), _( -97), _( 163), _(-1498), _(  185), _(-9585), _( -8540), _(-62684), _(65290), _(11455), _(9838), _(  288), _(1634),

-------------
Float is a typedef to float.

The preprocessor prints out:

const Float  Di_opt [32] [16] = {
   { (Float)(   0.L / 0x10000) , (Float)(  -29.L / 0x10000) , (Float)(  213.L / 0x10000) , (Float)(  -459.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -31.L / 0x10000) , (Float)(  218.L / 0x10000) , (Float)(  -519.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -35.L / 0x10000) , (Float)(  222.L / 0x10000) , (Float)(  -581.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -38.L / 0x10000) , (Float)(  225.L / 0x10000) , (Float)(  -645.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -41.L / 0x10000) , (Float)(  227.L / 0x10000) , (Float)(  -711.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -45.L / 0x10000) , (Float)(  228.L / 0x10000) , (Float)(  -779.L / 0x10000) , (Float)(
   { (Float)(  -1.L / 0x10000) , (Float)(  -49.L / 0x10000) , (Float)(  228.L / 0x10000) , (Float)(  -848.L / 0x10000) , (Float)(
   { (Float)(  -2.L / 0x10000) , (Float)(  -53.L / 0x10000) , (Float)(  227.L / 0x10000) , (Float)(  -919.L / 0x10000) , (Float)(
   { (Float)(  -2.L / 0x10000) , (Float)(  -58.L / 0x10000) , (Float)(  224.L / 0x10000) , (Float)(  -991.L / 0x10000) , (Float)(
   { (Float)(  -2.L / 0x10000) , (Float)(  -63.L / 0x10000) , (Float)(  221.L / 0x10000) , (Float)( -1064.L / 0x10000) , (Float)(
   { (Float)(  -2.L / 0x10000) , (Float)(  -68.L / 0x10000) , (Float)(  215.L / 0x10000) , (Float)( -1137.L / 0x10000) , (Float)(
   { (Float)(  -3.L / 0x10000) , (Float)(  -73.L / 0x10000) , (Float)(  208.L / 0x10000) , (Float)( -1210.L / 0x10000) , (Float)(
   { (Float)(  -3.L / 0x10000) , (Float)(  -79.L / 0x10000) , (Float)(  200.L / 0x10000) , (Float)( -1283.L / 0x10000) , (Float)(
   { (Float)(  -4.L / 0x10000) , (Float)(  -85.L / 0x10000) , (Float)(  189.L / 0x10000) , (Float)( -1356.L / 0x10000) , (Float)(
   { (Float)(  -4.L / 0x10000) , (Float)(  -91.L / 0x10000) , (Float)(  177.L / 0x10000) , (Float)( -1428.L / 0x10000) , (Float)(
   { (Float)(  -5.L / 0x10000) , (Float)(  -97.L / 0x10000) , (Float)(  163.L / 0x10000) , (Float)( -1498.L / 0x10000) , (Float)(
   { (Float)(  -5.L / 0x10000) , (Float)( -104.L / 0x10000) , (Float)(  146.L / 0x10000) , (Float)( -1567.L / 0x10000) , (Float)(
   { (Float)(  -6.L / 0x10000) , (Float)( -111.L / 0x10000) , (Float)(  127.L / 0x10000) , (Float)( -1634.L / 0x10000) , (Float)(
   { (Float)(  -7.L / 0x10000) , (Float)( -117.L / 0x10000) , (Float)(  106.L / 0x10000) , (Float)( -1698.L / 0x10000) , (Float)(
   { (Float)(  -7.L / 0x10000) , (Float)( -125.L / 0x10000) , (Float)(   83.L / 0x10000) , (Float)( -1759.L / 0x10000) , (Float)(
   { (Float)(  -8.L / 0x10000) , (Float)( -132.L / 0x10000) , (Float)(   57.L / 0x10000) , (Float)( -1817.L / 0x10000) , (Float)( -
   { (Float)(  -9.L / 0x10000) , (Float)( -139.L / 0x10000) , (Float)(   29.L / 0x10000) , (Float)( -1870.L / 0x10000) , (Float)( -
   { (Float)( -10.L / 0x10000) , (Float)( -147.L / 0x10000) , (Float)(   -2.L / 0x10000) , (Float)( -1919.L / 0x10000) , (Float)( -
   { (Float)( -11.L / 0x10000) , (Float)( -154.L / 0x10000) , (Float)(  -36.L / 0x10000) , (Float)( -1962.L / 0x10000) , (Float)( -
   { (Float)( -13.L / 0x10000) , (Float)( -161.L / 0x10000) , (Float)(  -72.L / 0x10000) , (Float)( -2001.L / 0x10000) , (Float)( -
   { (Float)( -14.L / 0x10000) , (Float)( -169.L / 0x10000) , (Float)( -111.L / 0x10000) , (Float)( -2032.L / 0x10000) , (Float)( -
   { (Float)( -16.L / 0x10000) , (Float)( -176.L / 0x10000) , (Float)( -153.L / 0x10000) , (Float)( -2057.L / 0x10000) , (Float)( -
   { (Float)( -17.L / 0x10000) , (Float)( -183.L / 0x10000) , (Float)( -197.L / 0x10000) , (Float)( -2075.L / 0x10000) , (Float)( -
   { (Float)( -19.L / 0x10000) , (Float)( -190.L / 0x10000) , (Float)( -244.L / 0x10000) , (Float)( -2085.L / 0x10000) , (Float)( -
   { (Float)( -21.L / 0x10000) , (Float)( -196.L / 0x10000) , (Float)( -294.L / 0x10000) , (Float)( -2087.L / 0x10000) , (Float)( -
   { (Float)( -24.L / 0x10000) , (Float)( -202.L / 0x10000) , (Float)( -347.L / 0x10000) , (Float)( -2080.L / 0x10000) , (Float)( -
   { (Float)( -26.L / 0x10000) , (Float)( -208.L / 0x10000) , (Float)( -401.L / 0x10000) , (Float)( -2063.L / 0x10000) , (Float)( -
};

The compiler complains:

synthtab.c:55: initializer element is not constant
synthtab.c:55: (near initialization for i_opt[30][8]')
synthtab.c:55: parse error before "L"
synthtab.c:55: initializer element is not constant
synthtab.c:55: (near initialization for i_opt[30][9]')
synthtab.c:55: parse error before "L"
synthtab.c:55: initializer element is not constant
synthtab.c:55: (near initialization for i_opt[30][10]')
synthtab.c:55: parse error before "L"
synthtab.c:55: initializer element is not constant
synthtab.c:55: (near initialization for i_opt[30][11]')
synthtab.c:55: parse error before "L"

(please remove the accent grave in quotations, it is wrong and Copy&Paste do not work with joe).


---------------------
May be the code is wrong, but it is compilable with:

  Turbo C 1.0, 2.0
  Turbo-C++ 1.01, 3.0 and 4.0
  Zortech C++ 3.01
  Watcom C++ 9.0
  gcc 2.x.x
  MS VC++
  Intel C++
  cc on Sparc
  cc on HPUX

-- 
Frank Klemm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]