ISO C violation (really -- style & string pasting)

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Thu Mar 25 14:26:00 GMT 1999


> Since the current uses of _GLOBAL_OFFSET_TABLE_ (which would
> NOT present a problem for, e.g., ELF) are hardcoded into literal
> strings in the compiler source (as part of instruction
> source lines), which in turn becomes part of the .s file,
> the symbol name needs to be changed in those strings,
> which becomes a preprocessor trick.

I see. If this is really a problem, why not just change the compiler?
Hacking with the preprocessor seems to produce more problems than it
solves. Consider

#define SHOW(x) printf(#x " is %d\n", x);

int main()
{
  int GLOBAL_OFFSET_TABLE_ = 1,
  SHOW(GLOBAL_OFFSET_TABLE_);
}

With your hack, you'd break this program.

Regards,
Martin


More information about the Gcc mailing list