Page 1 of 1

[NXC][Bug] Problem with Prototypes

Posted: 29 Nov 2010, 01:26
by muntoo
There seems to be a bug with prototypes in NXC.
v0_2_WithPrototypes.zip
A, B, D, D, E, F, G, H, J, K, L, N, P, S, R, T, V, X, Y, Z
(39.62 KiB) Downloaded 168 times
By commenting out 2 of the 5 defines in the following code (from BezierCurveSpeedTest.nxc), I can prevent a compile error:

Code: Select all

#define __BEZIERCURVE_NXC__LINEARBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__QUADRATICBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__CUBICBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__GENERALBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__BEZIERCURVE2DOUT__
So, for example, I do:

Code: Select all

#define __BEZIERCURVE_NXC__LINEARBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__QUADRATICBEZIERCURVE2DOUT__
#define __BEZIERCURVE_NXC__CUBICBEZIERCURVE2DOUT__
//#define __BEZIERCURVE_NXC__GENERALBEZIERCURVE2DOUT__
//#define __BEZIERCURVE_NXC__BEZIERCURVE2DOUT__
No more compile error!

Ignore my terrible programming practices with the define being an "anti-include/function-guard" (please suggest some better ones if you have any; I'm not sure what the best way is to prevent the same function being compiled twice, but being able to specify what you want to compile at the same time).
v0_2_WithPrototypes.zip
A, B, D, D, E, F, G, H, J, K, L, N, P, S, R, T, V, X, Y, Z
(39.62 KiB) Downloaded 168 times

Re: [NXC][Bug] Problem with Prototypes

Posted: 08 Apr 2011, 23:20
by muntoo
Any updates?

Re: [NXC][Bug] Problem with Prototypes

Posted: 09 Apr 2011, 21:22
by afanofosc
Thanks for not giving up on this, Muntoo. I have found and fixed a defect in the compiler as a result of your gentle reminders. Basically, if you have a prototype with "inline" as part of the prototype then it currently confuses the compiler as to whether it should be inlining functions or not. It so happens that an inline function does not need to have "inline" in its prototype so long as the actual function definition includes that keyword.

In any case, I have made the required code changes to fix this defect and will include the fix in the next test release.

John Hansen