Menu

#1 Using #define in structures brings bugs

open
nobody
None
5
2008-08-15
2008-08-15
Anonymous
No

I've been using this library at work (v0.4) and I've been very impressed with it, but I had some massive bugs integrating it with existing code, until I discovered that it was compiling with _ENABLE_FORCE and _ENABLE_TILT defined, but my code only defined _ENABLE_TILT (as I wasn't using the force data). As the structure defines members based on these defines, the size of the structure was different between the library and my code, and caused segmentation faults when my other data structures were overwritten.

I'd recommend not removing members by #define. Also, my version of gcc (4.2) complained at linking until I added -fPIC to the compile flags (TEXTREL added or some such in the library).

An excellent library, nevertheless.

Please mail to widget@stdin.co.uk for any correspondence, I can't remember my sf login.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.