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

Hans Petter Selasky hps at selasky.org
Tue Jun 9 11:24:04 UTC 2015


On 06/09/15 11:54, Hans Petter Selasky wrote:
> On 06/08/15 11:25, Poul-Henning Kamp wrote:
>> It's really a decision if we want to spread dependence on typeof()
>> to /usr/include isn't it ?
>
> Hi Paul-Henning,
>
> I'm aware about the typeof. Without typeof we would have to duplicate
> more of the queue macros, because in C++ you can make lists with both
> structs and classes. Else like some have suggested, we might drop the
> class/struct keyword, but that again will not work in external C
> sections in C++ files.
>

Hi Paul-Henning,

 From what I understand typeof() is a requirement for a C++ compiler 
while for C compilers not. I've update the patch to only use typeof for 
C++ where two different types can arise, and for C compilers keep the 
existing way in sys/queue.h. This also should make extern "C" code work 
assuming that if the C++ compiler supports typeof, it also works inside 
the extern "C".

--HPS



More information about the freebsd-hackers mailing list