INLINE compile failure in V7 RC1

Previous topic - Next topic

AndyH

This code gives an error in V7 (works in earlier versions):

Code (glbasic) Select
FUNCTION QSIN: x

    WHILE x>360.0;  DEC x, 360.0; WEND
    WHILE x<0;      INC x, 360.0; WEND
    IF x>180.0 THEN x = 180.0-x

    x = x/57.296
    x = 1.2732 * x -0.4053 * x * ABS(x)

x = 0.225*(x*ABS(x)-x)+x
RETURN x
ENDFUNCTION


FUNCTION QCOS: x
RETURN QSIN(x+90)
ENDFUNCTION


INLINE
float qInvSqrt(float x){
   float xhalf = 0.5f * x;
   int i = *(int*)&x; // store floating-point bits in integer
   i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
   x = *(float*)&i; // convert new bits into float
   x = x*(1.5f - xhalf*x*x); // One round of Newton's method
   return x;
}
ENDINLINE


FUNCTION QSQR: y
INLINE
return 1.0f / qInvSqrt(y);
ENDINLINE
ENDFUNCTION



_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.023 SN:4cca05d9 - 3D, NET
Wordcount:14 commands
compiling:
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: In function `float __GLBASIC__::qInvSqrt(float)':
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:135: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:154: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:158: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: At global scope:
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:170: error: expected `}' at end of input
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.6 sec. Time: 21:25
Build: 0 succeeded.
*** 1 FAILED ***

AndyH

Just spotted RC2 at the top of the forums DOH!  In this version it works.  Ignore me ;)