Re: Question on Objective C++
Re: Question on Objective C++
- Subject: Re: Question on Objective C++
- From: "Erik M. Buck" <email@hidden>
- Date: Wed, 6 Mar 2002 13:40:25 -0600
All Objective-C instance variables are initialized to the bit pattern 0 when
the object is allocated.
I know of no reason why Objective-C objects can not have pointers to
instances of C++ classes that have virtual member functions. Objective-C
likes to use pointers. I don't think it works to store references or C++
objects themselves as instance variables of Objective-C objects unless the
C++ objects are effectively just structs.
Depending on how you are using C++ smart pointers, you may have problems.
Objective-C will not automatically call destructors of C++ object instance
variables.
----- Original Message -----
From: "Oscar Morales Vivs" <email@hidden>
To: <email@hidden>
Sent: Wednesday, March 06, 2002 11:46 AM
Subject: Question on Objective C++
>
Hi there. I'm trying to build a Cocoa front-end to a bunch of C++ code I
>
have. I've read the Objective-C++ documentation and it seems it will
>
work fine for me. There's a couple of doubts I have, however.
>
>
The docs state that the only C++ object instances that you can put in an
>
Objective-C object are those that don't have virtual functions. It also
>
says that constructors and destructors won't be called when init/dealloc
>
the object. However: is there some kind of default initialization done
>
on the instance data of an Objective-C object? The C++ objects I plan to
>
use as instance variables are smart pointers which would be fine if they
>
were initialized to 0 (as I could later change their value in init) but
>
would cause me no end of troubles if garbage were left on them. The docs
>
didn't make it clear on this point.
>
>
Thanks in advance for your help.
>
>
Oscar Morales.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.