Make "sys/queue.h" usable with C++

Hans Petter Selasky hps at bitfrost.no
Thu Jan 16 12:38:33 UTC 2014


Hi,

I'm using "sys/queue.h" with some C++ programs. The only problem is that 
you cannot make an ENTRY() using classes without getting some compiler 
warnings, because all macros in "sys/queue.h" assume "struct".

My simple patch is to add something like:

#ifdef "C++"
#define QUEUE_STRUCT
#else
#define QUEUE_STRUCT struct
#endif

And use QUEUE_STRUCT instead of "struct" everywhere inside 
"sys/queue.h". Any opinions about this?

--HPS


More information about the freebsd-hackers mailing list