From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 16 14:05:31 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79907B78 for ; Thu, 16 Jan 2014 14:05:31 +0000 (UTC) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 531551FBC for ; Thu, 16 Jan 2014 14:05:31 +0000 (UTC) Received: from latitude.home.vangyzen.net (localhost [127.0.0.1]) by smtp.vangyzen.net (Postfix) with ESMTP id C6EB756436; Thu, 16 Jan 2014 08:05:29 -0600 (CST) Message-ID: <52D7E728.1010606@vangyzen.net> Date: Thu, 16 Jan 2014 08:05:28 -0600 From: Eric van Gyzen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Hans Petter Selasky , "freebsd-hackers@freebsd.org" Subject: Re: Make "sys/queue.h" usable with C++ References: <52D7D302.3090403@bitfrost.no> In-Reply-To: <52D7D302.3090403@bitfrost.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 14:05:31 -0000 On 01/16/2014 06:39 AM, Hans Petter Selasky wrote: > 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". > > My simple patch is to add something like: > > #ifdef "C++" > #define QUEUE_STRUCT > #else > #define QUEUE_STRUCT struct > #endif > > And use QUEUE_STRUCT instead of "struct" everywhere inside > "sys/queue.h". Any opinions about this? Sounds great to me...not that my opinion matters much. :) I expect you will want to use "#ifdef __cplusplus". Eric