public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* two constructor copies in object file
@ 2002-01-16 16:19 Rogelio M. Serrano Jr.
  0 siblings, 0 replies; only message in thread
From: Rogelio M. Serrano Jr. @ 2002-01-16 16:19 UTC (permalink / raw)
  To: gcc-help


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<char*>((reinterpret_cast<unsigned int>(_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?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-17  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-16 16:19 two constructor copies in object file Rogelio M. Serrano Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).