• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
problems with Objective-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with Objective-C++


  • Subject: problems with Objective-C++
  • From: "Simson L.Garfinkel" <email@hidden>
  • Date: Mon, 21 Jan 2002 15:47:06 -0500

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.


  • Follow-Ups:
    • Re: problems with Objective-C++
      • From: Ingvar Nedrebo <email@hidden>
    • Re: problems with Objective-C++
      • From: Andrew Pinski <email@hidden>
  • Prev by Date: NSColor colorWithPatternImage: texture origin?
  • Next by Date: Serial Number
  • Previous by thread: NSColor colorWithPatternImage: texture origin?
  • Next by thread: Re: problems with Objective-C++
  • Index(es):
    • Date
    • Thread