Attribute Pure

Patrick Pelissier Patrick.Pelissier at loria.fr
Mon Feb 23 09:39:18 CET 2004


> "pure" and "const" tell gcc enough to let it give a normal sort of
> warning for statement with no effect, or whatever, if it wants to, or
> if one asks for it.

 That's why I thought, but It seems that:

__attribute__((__const__/*, __warn_unused_result__*/))
int f(int x)
{
  return x*x;
}

int main() {
  f(45);
  return 0;
}

compiled with: 
 gcc -c t.c -Wall -W -pedantic -ansi -O2

doesn't produce any warnings. Maybe I have forgotten an option?

 Sincerely,
  Patrick Pelissier


More information about the gmp-devel mailing list