I'm trying to build libaubio using VC++8. There's a function that essentially boils down to the above, once I've allowed for a couple of #defines (EXP and LOG, respectively).Code:#include <math.h>
void SomeFunc()
{
float_t winlen = 4;
float_t rayparam = 48./512. * winlen;
float dfwvnorm = expf ( (logf(2.0)/rayparam) * (winlen+2) ); // <-- compiler error if I use 'logf' but not if I use 'log'
}
If I use (log(2.0)/rayparam) my compiler seems happy. But if I use (logf(2.0)/rayparam) (which was originally intended in the code) the compiler complains with error C2143: syntax error : missing ')' before ';'. And yet from looking at math.h, logf is defined everywhere that expf is defined. AFAICT they're defined as functions for 64-bit compiles and as macros for 32-bit (mine's 32-bit). Can anyone suggest a reason why the compiler is happy to accept the expf macro but not logf?
[Edit...] Amazingly, I've discovered a bug in math.h. the macro for logf incorrectly has a semicolon at the end - i.e
Currently I'm using VC2005 Professional but previously I'd been using VC2005 Express. I've just looked in the Express version's copy of math.h and that doesn't have the problem!Quote:
#define logf(x) ((float)log((double)(x)));

