public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* constructors created twice in object files
@ 2002-01-14 15:31 Rogelio M. Serrano Jr.
  0 siblings, 0 replies; only message in thread
From: Rogelio M. Serrano Jr. @ 2002-01-14 15:31 UTC (permalink / raw)
  To: gcc-help


Why are constructors generated twice when compiling?

for example:

#ifndef __Q_BOOT_OBJ____
#define __Q_BOOT_OBJ____


class boot_obj
{
public:
    static char* top_of_heap;

    boot_obj() throw(); 
    boot_obj(boot_obj& x) throw(); 
    void*  boot_alloc(unsigned int) throw();  
};

#include "boot_obj"

extern "C" char* _end;

boot_obj::boot_obj() throw ()
{
   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;  
} 

I get this after compiling:

00000058 T _ZN8boot_obj10boot_allocEj
         U _ZN8boot_obj11top_of_heapE
00000050 T _ZN8boot_objC1ERS_
00000024 T _ZN8boot_objC1Ev
00000048 T _ZN8boot_objC2ERS_
00000000 T _ZN8boot_objC2Ev
         U _end

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

only message in thread, other threads:[~2002-01-14 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-14 15:31 constructors created twice in object files 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).