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

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Jan 16 13:46:29 UTC 2014


In message <52D7D302.3090403 at bitfrost.no>, Hans Petter Selasky writes:
>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".

I came >< this close to removing the assumed struct many years ago
when I orthogonalized sys/queue.h, but were persuaded by others that
it was pointless and that nobody were ever going to use it with C++
anyway, C++ being so much more evolved in such aspects :-)

Wouldn't

	#ifndef SYS_QUEUE_STRUCT
	#  define SYS_QUEUE_STRUCT struct
	#endif

Make more sense ?

That would allow C code to also make the struct explicit.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-hackers mailing list