Re: problems with Objective-C++
Re: problems with Objective-C++
- Subject: Re: problems with Objective-C++
- From: Andrew Pinski <email@hidden>
- Date: Mon, 21 Jan 2002 21:39:29 -0500
The reason why it takes longer is because Apple forgot to turn on
pre-compiled headers on (this was answered before look into the
archives.).
Thanks
Andrew Pinski
On Monday, January 21, 2002, at 03:47 , Simson L.Garfinkel wrote:
It has been commented on this mailing list that Objective-C++ takes 20x
longer to compile a file than Objective-C or C++, but nobody has ever
said why or what to do about it.
I am working on a large project that involves Objective-C and C++. I
had wanted to use Objective-C++. Changing the extension of an
Objective-C file from .m to .mm I saw the size of each .o file balloon
from approximately 200k to 6M! I saw compile times go from 2-3 seconds
to 30-60 seconds!
This was unacceptable.
So what I have done is I have tried to segregate the cross between the
Objective-C world and the C++ world to as few areas as possible. right
now it is in 2 classes. These are the only two that are .mm files; the
rest are .m files. These are the two classes that have C++ objects in
their instance variables. There is no problem messaging these classes
from .m files, so it's a huge win, really. If other methods need to
call C++ classes but not have C++ objects as instance variables, I put
all of those methods into a separate .mm file that is done as a
category.
All of this works, but it is kind of difficult.