From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 9 12:56:39 2015 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9ED052DD; Tue, 9 Jun 2015 12:56:39 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 8011116A3; Tue, 9 Jun 2015 12:56:38 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from marvin.lab.vangyzen.net (c-73-147-253-17.hsd1.va.comcast.net [73.147.253.17]) by smtp.vangyzen.net (Postfix) with ESMTPSA id CEFAC56475; Tue, 9 Jun 2015 07:56:31 -0500 (CDT) Message-ID: <5576E28A.90808@vangyzen.net> Date: Tue, 09 Jun 2015 08:56:42 -0400 From: Eric van Gyzen User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Hans Petter Selasky , Poul-Henning Kamp CC: "freebsd-hackers@freebsd.org" , Ian Lepore Subject: Re: Make "sys/queue.h" usable with C++ 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> In-Reply-To: <5576B7C4.2050707@selasky.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2015 12:56:39 -0000 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 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