This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Volatile constants?
- To: <gcc at gcc dot gnu dot org>
- Subject: Volatile constants?
- From: "Christian Häggström" <97nv46 at skola dot kiruna dot se>
- Date: Wed, 29 Mar 2000 14:56:14 +0200
The GCC manual says "An Inline Function is As Fast As a Macro",
but when I compile this, I got error "initializer element is not constant" on
's' initialization.
inline int abs1(int x) {
return x<0 ? -x : x;
}
#define abs2(x) (x<0 ? -x : x)
int r = abs1(-7);
int s = abs2(-7);
Is there any option I have to pass?
g++ produces a constructor function for 's' but not for 'r'. Why?