From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 9 11:24:04 2015 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BB504A1; Tue, 9 Jun 2015 11:24:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCA061F80; Tue, 9 Jun 2015 11:24:03 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C98781FE023; Tue, 9 Jun 2015 13:23:59 +0200 (CEST) Message-ID: <5576CCFF.5040608@selasky.org> Date: Tue, 09 Jun 2015 13:24:47 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: 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; format=flowed 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 11:24:04 -0000 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