Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Jun 2015 08:56:42 -0400
From:      Eric van Gyzen <eric@vangyzen.net>
To:        Hans Petter Selasky <hps@selasky.org>, Poul-Henning Kamp <phk@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@FreeBSD.org>,  Ian Lepore <ian@FreeBSD.org>
Subject:   Re: Make "sys/queue.h" usable with C++
Message-ID:  <5576E28A.90808@vangyzen.net>
In-Reply-To: <5576B7C4.2050707@selasky.org>
References:  <52D7D302.3090403@bitfrost.no> <1679.1389879981@critter.freebsd.dk> <52D7E674.4010501@bitfrost.no> <16417.1389881910@critter.freebsd.dk> <1389890913.1230.64.camel@revolution.hippie.lan> <52D8C268.1080009@bitfrost.no> <52D95A8E.3000006@freebsd.org> <55734622.5090808@selasky.org> <29842.1433755547@critter.freebsd.dk> <5576B7C4.2050707@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 06/09/2015 05: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.

Did you test your claim in the last sentence?  I did.  Dropping the class/struct keyword in __cplusplus works fine under 'extern "C"'.  If you _did_ test and it failed, please show your code to clarify any miscommunication.

Dropping the class/struct keyword has the advantage that it does not change the API.  It has the disadvantage that types must be declared before they're used when #including <sys/queue.h> in C++ code.  The latter is simply good form.  There are three trivial declarations to fix in the src tree.  An exprun would find those in ports and give a feel for the incidence rate in non-ports code.  I would request this if anyone else is interested in this alternative.

	https://reviews.freebsd.org/D2767

Eric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5576E28A.90808>