From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26562 invoked by alias); 10 Sep 2004 10:40:10 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 26552 invoked from network); 10 Sep 2004 10:40:08 -0000 Received: from unknown (HELO psmtp.com) (12.158.35.213) by sourceware.org with SMTP; 10 Sep 2004 10:40:08 -0000 Received: from source ([192.150.22.7]) by exprod6ob3.obsmtp.com ([12.158.35.250]) with SMTP; Fri, 10 Sep 2004 03:40:05 PDT Received: from inner-relay-3.corp.adobe.com (inner-relay-3 [153.32.251.51]) by smtp-relay-7.sea.adobe.com (8.12.10/8.12.10) with ESMTP id i8AAe2Nf024296; Fri, 10 Sep 2004 03:40:05 -0700 (PDT) Received: from iplan-mn (iplan-mn.corp.adobe.com [130.248.25.5]) by inner-relay-3.corp.adobe.com (8.12.9/8.12.9) with ESMTP id i8AAe1kq011433; Fri, 10 Sep 2004 03:40:02 -0700 (PDT) Received: from mn-eljay-a51m.adobe.com ([130.248.178.70]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0I3T008D6MYN5Y@iplan-mn.corp.adobe.com>; Fri, 10 Sep 2004 05:40:00 -0500 (CDT) Date: Fri, 10 Sep 2004 10:40:00 -0000 From: Eljay Love-Jensen Subject: Re: extern functions in header file In-reply-to: <20040910062659.M23072@wire.cs.nthu.edu.tw> X-Sender: eljay@iplan-mn.corp.adobe.com To: Ming-Chia Jiang , gcc-help@gcc.gnu.org Message-id: <6.1.2.0.2.20040910053141.02d76340@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <20040910062659.M23072@wire.cs.nthu.edu.tw> X-SW-Source: 2004-09/txt/msg00084.txt.bz2 Hi Ming-Chia, >Is there any difference between declaring functions with prefix "extern" and without "extern" keyword in header files? From a C++ vantage point... Effectively (by and large), no there's no difference. Philosophically, yes. Some consider (including myself) that supplying the (optional) extern keyword is good practice because it is self-documenting code. Also, be aware that extern "C" has several important (critical!) implications regarding C++ code. Also, in some areas, extern is REQUIRED to distinguish something that is "just a declaration" from being mistaken for a "definition" (without having the extern). See Stroustrup's C++ Programming Language (3rd or special edition) section 9.2. I haven't done C work since 1990, so my comments may not be appropriate for C "good style / best practices". HTH, --Eljay