[vox-tech] C99 functions - what does "type generic" really mean?
Peter Jay Salzman
p at dirac.org
Sun Oct 24 08:56:05 PDT 2004
I'm trying to get one of my programs to compile and run on a 64bit alpha
running Debian/unstable.
gcc is generating "implicit declaration" errors (I'm using -Werror) for
functions like ceill(), sqrtl(), logl(), etc.
I always took <tgmath.h> to be declarations for math functions that work on
any kind of data type, like a sqrt that returns a long double (named sqrtl)
or a ceil that returns a float (named ceilf).
But upon a little reading, I think I might be incorrect.
Is the point of tgmath to allow us to use sqrt() for ANY floating point type
and the compiler will take care of the details of calling the proper version
of the function?
If so, the compiler can certainly guess which math function we want to use,
but in the snippet:
long double ret;
float arg;
ret = sqrt(arg);
would the compiler choose sqrtl() or sqrtf() as the backend to sqrt()?
Or was I originally correct in thinking that it's up to us to invoke which
function we want explicitly, like:
long double ret;
long double arg;
ret = sqrtl(arg);
Pete
More information about the vox-tech
mailing list