From owner-freebsd-current@FreeBSD.ORG Mon Feb 16 08:42:34 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D817106564A for ; Mon, 16 Feb 2009 08:42:34 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 71CE68FC1A for ; Mon, 16 Feb 2009 08:42:33 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA03204; Mon, 16 Feb 2009 10:42:15 +0200 (EET) (envelope-from avg@icyb.net.ua) Received: from localhost.topspin.kiev.ua ([127.0.0.1] helo=edge.pp.kiev.ua) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1LYz3P-0005bf-Bl; Mon, 16 Feb 2009 10:42:15 +0200 Message-ID: <499926E4.3060207@icyb.net.ua> Date: Mon, 16 Feb 2009 10:42:12 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.19 (X11/20090114) MIME-Version: 1.0 To: Andrew Reilly References: <4995BB1B.7060201@icyb.net.ua> <20090213231513.GA20223@duncan.reilly.home> <4997F105.5020409@icyb.net.ua> <499811DF.6030905@incunabulum.net> <20090215151318.0d17bfb9@ernst.jennejohn.org> <49983868.5010107@incunabulum.net> <20090215182420.774b90c3@ernst.jennejohn.org> <49985807.805@protected-networks.net> <49985AEE.1010709@gmx.de> <20090216060716.GC70145@duncan.reilly.home> In-Reply-To: <20090216060716.GC70145@duncan.reilly.home> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Christoph Mallon , Michael Butler , Bruce Simpson , freebsd-current@freebsd.org Subject: Re: weeding out c++ keywords from sys/sys X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 08:42:34 -0000 on 16/02/2009 08:07 Andrew Reilly said the following: > On Sun, Feb 15, 2009 at 07:11:58PM +0100, Christoph Mallon wrote: >> Michael Butler schrieb: >>> .. stops C++ from mangling the prototyped functions so they'll link >>> correctly but does it temporarily disable the "reserved word" tests? >>> Should it? ;-) >> No, it doesn't. extern $STRING (the standard only requires "C" and >> "C++", but there can be more) just changes the linkage of declarations >> (name mangling, calling convention). > > I've always wondered: why does the extern "C" {} cruft have to > be pushed into all C headers, rather than being wrapped around > the #include <> lines in the C++ source that includes them? > Then you wouldn't need the #ifdef __cplusplus conditional, > because you already know that it's C++ code. Common usage seems > to have it backwards, but I assume that there must be a reason. > Since this thread has already strayed beyond the original topic, I now feel free to participate in it again. I think that there are two approaches. Current C++ code for our kernel does exactly what you say - puts extern C around inclusion of system headers. But if someone decides to purposefully provide C headers that are both C and C++ -friendly, then they typically put conditional extern into the headers. I wouldn't suggest doing that to FreeBSD headers though (yet). -- Andriy Gapon