Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jan 2014 08:05:28 -0600
From:      Eric van Gyzen <eric@vangyzen.net>
To:        Hans Petter Selasky <hps@bitfrost.no>,  "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Make "sys/queue.h" usable with C++
Message-ID:  <52D7E728.1010606@vangyzen.net>
In-Reply-To: <52D7D302.3090403@bitfrost.no>
References:  <52D7D302.3090403@bitfrost.no>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52D7E728.1010606>