This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Spurious run time type info constructors



Add -fno-rtti to your list of C++ compilation option flags.

-----Original Message-----
From: Palmer.Chris [mailto:Chris.Palmer@IGT.com]
Sent: Tuesday, March 06, 2001 6:17 AM
To: 'crossgcc'
Subject: Spurious run time type info constructors


Hi,
	I am developing an m68k embedded system using C++ which involves a
large number of relatively small classes. Each class has its own .h and .cpp
files. The .h naturally includes the .h files for any base classes, or
associated classes. Objects are only instantiated statically in the .cpp of
the class to which they belong.

	If a class has virtual functions, then a vtable is generated which
includes a pointer to a run time type info constructor. This causes an rtti
constructor to be generated which calls rtti constructors for all the base
classes, fair enough. The problem I have is that rtti constructors are than
also generated for all the associated classes declared in the included .h
files. These constructors are not referenced locally and are not globaled so
they are never used. They are however a huge overhead in code size. For the
number of classes I have at the moment I estimate 50% of the code is taken
up by these rtti constructors which are never called. As the number of
classes gets bigger the overhead gets worse.

	Does anybody know a way of preventing this behaviour? I am not using
rtti so an option to disable it would be useful. 

	Is it a bug or a lack of optimisation ?. I.e. are these spurious
constructors needed in some situations that do not occur in my project, or
are they never used?

	As a matter of interest, why are rtti constructors virtual when
ordinary constructors are not?

TIA,
Chris Palmer



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sourceware.cygnus.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]