From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31006 invoked by alias); 17 Oct 2005 12:05:43 -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 30987 invoked by uid 22791); 17 Oct 2005 12:05:41 -0000 Received: from exprod6og8.obsmtp.com (HELO psmtp.com) (64.18.1.128) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 17 Oct 2005 12:05:41 +0000 Received: from source ([192.150.20.142]) by exprod6ob8.obsmtp.com ([64.18.5.12]) with SMTP; Mon, 17 Oct 2005 05:05:38 PDT Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id j9HCBgXP008934; Mon, 17 Oct 2005 05:11:47 -0700 (PDT) Received: from fe2.corp.adobe.com (fe2.corp.adobe.com [10.8.192.72]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id j9HC5Kn2009232; Mon, 17 Oct 2005 05:05:20 -0700 (PDT) Received: from namail3.corp.adobe.com ([10.8.192.66]) by fe2.corp.adobe.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 17 Oct 2005 05:05:20 -0700 Received: from 10.32.16.88 ([10.32.16.88]) by namail3.corp.adobe.com ([10.8.192.66]) via Exchange Front-End Server namailhost.corp.adobe.com ([10.8.192.72]) with Microsoft Exchange Server HTTP-DAV ; Mon, 17 Oct 2005 12:05:20 +0000 User-Agent: Microsoft-Entourage/11.2.0.050811 Date: Mon, 17 Oct 2005 12:05:00 -0000 Subject: Re: C++ static integer class constants... From: John Love-Jensen To: John Ratliff , MSX to GCC Message-ID: In-Reply-To: <200510160743.j9G7hVoa010304@inbound-smtp-1.corp.adobe.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-SW-Source: 2005-10/txt/msg00095.txt.bz2 Hi John, To get the behavior you want without having to define the static class constant in some translation unit, use an anonymous enum: class foo { public: enum { X = 5, Y = 10, Z = 15 }; }; >Is this correct behavior? I believe your example demonstrates the correct behavior. In that *IF* you specify the value of a static const int in the declaration, that both you *MUST* define the static const int in one-and-only-one translation unit, and you *MUST NOT* specify the initialization value in that definition. HTH, --Eljay