• 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
Re: Obj-C++ Tuturial Anywhere?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C++ Tuturial Anywhere?


  • Subject: Re: Obj-C++ Tuturial Anywhere?
  • From: Andreas Monitzer <email@hidden>
  • Date: Thu, 16 Aug 2001 00:25:16 +0200

On Thursday, August 16, 2001, at 12:03 , Todd Blanchard wrote:

Sure - here is my guidelines.

1) Minimize the use of C++ constructs as much as possible - zero is ideal.
2) Don't export C++ interfaces in your frameworks - only export Objective C
wrappers.
3) When considering the use of templates, see 1.
4) Ditto operator overloading.
5) The only other good use might be the following "smart releasing pointer"
class:

class Id
{
id _object;
Id(id obj) : _object([obj retain]) {}
~Id() { [_object release]; }
operator id() { return _object; }
}

...
{
Id foo = [MyClass newObject];

} // destructor releases foo

This might not work though - I haven't tried it as I don't have the new
thingy.

Correct C++ is:

Id foo([MyClass newObject]);

as far as I can remember (been a while :). However, using autorelease is much easier and does the same.

And my guideline is:

6) Don't create new C++-classes. Use ObjC++ only for porting legacy code or declaring variables in the middle of a block (hehe :-).

andy
--
Description forthcoming.


  • Follow-Ups:
    • Re: Obj-C++ Tuturial Anywhere?
      • From: "Dennis C. De Mars" <email@hidden>
References: 
 >RE: Obj-C++ Tuturial Anywhere? (From: "Todd Blanchard" <email@hidden>)

  • Prev by Date: Window resizing make weird things happen
  • Next by Date: Re: EOF Advocacy, Open Source?
  • Previous by thread: RE: Obj-C++ Tuturial Anywhere?
  • Next by thread: Re: Obj-C++ Tuturial Anywhere?
  • Index(es):
    • Date
    • Thread