[NXC][Bug] Problem with Prototypes

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

[NXC][Bug] Problem with Prototypes

Post 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
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC][Bug] Problem with Prototypes

Post by muntoo »

Any updates?
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: [NXC][Bug] Problem with Prototypes

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest