Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting Objective-C++ to work



On Wednesday, September 10, 2003, at 01:56 PM, Glen Fisher wrote:

In addition, it's very much *not* safe to pass C++ objects to Objective-C methods, or to have an Objective-C method return a C++ object. The object is copied to or from the method using a bitwise copy; the class's copy constructor isn't invoked, nor is the class's destructor called for the copy.

This scared me, so I looked over my code to see if I was sending a C++ object in by value instead of by reference or pointer. In only two cases I was. But the copy constructor was being called fine. I also had a C++ object returned a few times by an Objective C method to a C++ caller, and that was working fine. What am I missing? This is with GCC 3.1 on the ancient April 2002 dev tools.

I wrote up a test program, and no destructor was called on the object passed in, though.

- jim
_______________________________________________
projectbuilder-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/projectbuilder-users
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.