[Spread-users] The NULL/C++ bug

John Schultz jschultz at spreadconcepts.com
Tue Jun 13 16:58:37 EDT 2006


Andrew Barnert wrote:

>Over a month ago, I pointed out a bug in Spread 3.17.3 that prevents
>using its C/C++ interface from C++ (or at least a conforming compiler
>like gcc4 or VC8--it works in gcc2 and VC7): it tries to #define NULL as
>(void *)0. I emailed a trivial patch to the list and to
>spread at spread.org, and I've heard nothing from any of the maintainers. 
>
>Is there any intention to fix it in a 3.17.4 (or 3.18 or 3.17.3.1 or
>whatever) release? Is there even going to be another 3.x release? If we
>have to maintain a patch locally, that's fine, but it'd be nice to know
>that.
>
>The obvious fix (as suggested by Neil Conway) is to #include <stddef.h>
>at the top of sp_events.h instead of trying to #define NULL. 
>
>This would be better than my patch, unless there's some good reason to
>avoid this (e.g., Spread would otherwise compile with a freestanding
>implementation on some embedded platform without standard headers). If
>that's the case, here are some other possibilities that should work for
>everything from ancient C compilers to modern C++ and C99 compilers:
>
>* Replace NULL with 0 in the one or two places it appears
>* Conditionally #define NULL as 0 for C++, (void *)0 for C 
>  (as in the patch I submitted)
>* #define and use SP_NULL instead of NULL
>* Just assume that standard NULL is available so it'll be a 
>  compiler error to #include sp_events.h without including the 
>  standard headers first. 
>
>
>  
>
Andrew,

Sorry we didn't get back to you sooner, but yes we agree that we 
shouldn't be #defining NULL (legacy artifact) and we agree that 
including stddef.h is probably the best way forward.

There will be a maintanence release for 3.17, which will be patch 
version 4, that will address this and a few other known and fixed bugs 
in the not too distant future.  I will try to find out the timeframe for 
that release and post it to the list.

For Spread 4, we are in release candidate 2 and we are awaiting any 
further feedback and kicking around a few very minor changes we may or 
may not want to include.  An official release should be occurring within 
the next month or two but should not be substantially different than the 
rc2 release.

---
John Schultz
Spread Concepts LLC
Phn:  301 498 3233
Cell: 443 838 2200





More information about the Spread-users mailing list