From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1786 invoked by alias); 25 May 2009 04:36:12 -0000 Received: (qmail 1778 invoked by uid 22791); 25 May 2009 04:36:11 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 May 2009 04:36:07 +0000 Received: from wpaz9.hot.corp.google.com (wpaz9.hot.corp.google.com [172.24.198.73]) by smtp-out.google.com with ESMTP id n4P4a4uA020599; Sun, 24 May 2009 21:36:04 -0700 Received: from smtp.corp.google.com (spacemonkey1.corp.google.com [192.168.120.115]) by wpaz9.hot.corp.google.com with ESMTP id n4P4a1LN007153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 24 May 2009 21:36:02 -0700 Received: from localhost.localdomain.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) (authenticated bits=0) by smtp.corp.google.com (8.13.8/8.13.8) with ESMTP id n4P4a0a8018779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 24 May 2009 21:36:00 -0700 To: Joern Rennecke Cc: gcc@gcc.gnu.org Subject: Re: extern const (Was: Re: [gcc-in-cxx]: patches from multi-target-4_4-branch) References: <20090429064704.r7nzgfg18okko8s8-nzlynne@webmail.spamcop.net> <20090524121328.5bxlsmbf4cgos440-nzlynne@webmail.spamcop.net> <20090524232321.v5panilqo84484cg-nzlynne@webmail.spamcop.net> <20090525003131.arvkcfvxxcs00gsw-nzlynne@webmail.spamcop.net> From: Ian Lance Taylor Date: Mon, 25 May 2009 12:42:00 -0000 In-Reply-To: <20090525003131.arvkcfvxxcs00gsw-nzlynne@webmail.spamcop.net> (Joern Rennecke's message of "Mon\, 25 May 2009 00\:31\:31 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-05/txt/msg00613.txt.bz2 Joern Rennecke writes: > Quoting Ian Lance Taylor : > >> Joern Rennecke writes: >>> ... Could we use a #define >>> for this? E.g. put in system.h >>> #ifdef __cplusplus >>> #define CONST_VAR_DECL extern const >>> #else >>> #define CONST_VAR_DECL const >>> #endif >> >> Yes, that is certainly the way to go if it is in fact not safe to use >> "extern const int i = 1;" for all C compilers. I hadn't planned to deal >> with this issue yet, but since you bring it up, we should decide whether >> that construct is safe, or whether we need the macro. > > I think it would also be a better interim solution, since it is easier to > code, easier to switch experimentally, and easier to globally replace with > extern const if we decide that that is safe for all the C bootstrap compilers > we care about. Seems reasonable, though I'd like to wait at least a couple of days to see if anybody else has a comment. I think the macro name should simply be EXTERN_CONST. Ian