Make "sys/queue.h" usable with C++
Eric van Gyzen
eric at vangyzen.net
Thu Jan 16 14:05:31 UTC 2014
On 01/16/2014 06:39 AM, Hans Petter Selasky wrote:
> 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?
Sounds great to me...not that my opinion matters much. :)
I expect you will want to use "#ifdef __cplusplus".
Eric
More information about the freebsd-hackers
mailing list