From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26780 invoked by alias); 7 Sep 2004 13:02:22 -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 26601 invoked from network); 7 Sep 2004 13:02:14 -0000 Received: from unknown (HELO psmtp.com) (12.158.35.212) by sourceware.org with SMTP; 7 Sep 2004 13:02:14 -0000 Received: from source ([192.150.22.7]) by exprod6ob2.obsmtp.com ([12.158.35.250]) with SMTP; Tue, 07 Sep 2004 06:01:58 PDT Received: from inner-relay-1.corp.adobe.com (inner-relay-1 [153.32.1.51]) by smtp-relay-7.sea.adobe.com (8.12.10/8.12.10) with ESMTP id i87D1wNf021227; Tue, 7 Sep 2004 06:01:58 -0700 (PDT) Received: from iplan-mn (iplan-mn.corp.adobe.com [130.248.25.5]) by inner-relay-1.corp.adobe.com (8.12.9/8.12.9) with ESMTP id i87D1vTk020051; Tue, 7 Sep 2004 06:01:57 -0700 (PDT) Received: from mn-eljay-a51m.adobe.com ([130.248.178.90]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0I3O00IIJ9J8EY@iplan-mn.corp.adobe.com>; Tue, 07 Sep 2004 08:01:57 -0500 (CDT) Date: Tue, 07 Sep 2004 13:02:00 -0000 From: Eljay Love-Jensen Subject: Re: dynamic library and initialisation In-reply-to: <20040906134933.19b717e2.sebpilate@free.fr> X-Sender: eljay@iplan-mn.corp.adobe.com To: sebpilate , gcc-help@gcc.gnu.org Message-id: <6.1.2.0.2.20040907075907.02065a10@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <20040906134933.19b717e2.sebpilate@free.fr> X-SW-Source: 2004-09/txt/msg00050.txt.bz2 Hi Sebastien, Use an class method accessor to guarantee initialization. class NoGood { public: static Thingy thing; }; // Hey, not always initialized! Thingy NoGood::thing("alpha", "beta"); - - - - - class ThisWorks { public: static Thingy& GetThingy(); }; Thingy& ThisWorks::GetThingy() { static Thingy thing("alpha", "beta"); return thing; } HTH, --Eljay