From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23786 invoked by alias); 17 Jan 2002 00:29:32 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23754 invoked from network); 17 Jan 2002 00:29:27 -0000 Received: from unknown (HELO athena-new.evoserve.com) (210.16.10.134) by sources.redhat.com with SMTP; 17 Jan 2002 00:29:27 -0000 Received: from coffeesaur (ruf1-29.evoserve.com [210.16.6.29]) by athena-new.evoserve.com (8.9.1/8.9.3) with ESMTP id IAA20607 for ; Thu, 17 Jan 2002 08:45:47 +0800 Received: from localhost ([127.0.0.1] helo=quarq.com) by coffeesaur with esmtp (Exim 3.33 #1 (Debian)) id 16R0Qi-000099-00 for ; Thu, 17 Jan 2002 08:29:20 +0800 To: gcc@gcc.gnu.org Subject: two constructor copies in object file Date: Wed, 16 Jan 2002 18:53:00 -0000 From: "Rogelio M. Serrano Jr." Message-Id: X-SW-Source: 2002-01/txt/msg01193.txt.bz2 I compiled the following code with: g++-3.1 -nostdinc -nostdinc++ -c g++ is snapshot 20020114 with threads disabled. extern "C" char* _end; class boot_obj { protected: static char* top_of_heap; boot_obj() throw(); boot_obj(boot_obj& x) throw(); void* boot_alloc(unsigned int) throw(); }; boot_obj::boot_obj() throw () { static bool started = false; if (!started) { top_of_heap = reinterpret_cast((reinterpret_cast(_end) + 0x01) & ~0x01); started = false; } } boot_obj::boot_obj(boot_obj& x) throw () { } void* boot_obj::boot_alloc(unsigned int sz) throw () { void* ret = top_of_heap; top_of_heap += ((sz + 0x01) & ~0x01); return ret; } nm --demangle yeilds the following: 0000005c T boot_obj::boot_alloc(unsigned) U boot_obj::top_of_heap 00000054 T boot_obj::boot_obj(boot_obj&) 00000026 T boot_obj::boot_obj() 0000004c T boot_obj::boot_obj(boot_obj&) 00000000 T boot_obj::boot_obj() 00000000 d boot_obj::boot_obj()::started U _end Why are the constructors created twice? and why is the static member undefined?