Re: Xcode 5 & Obj-C++
Re: Xcode 5 & Obj-C++
- Subject: Re: Xcode 5 & Obj-C++
- From: Peter Teeson <email@hidden>
- Date: Thu, 30 Jan 2014 08:35:47 -0500
The recent flood of language philosophy is informative and interesting but doesn't address the issues I am interested in.
My case is one of using the C++ std lib for the containers to work with traversing a special DAG graph.
I've not found any C or Obj-C code that provides those and I see no reason to write them myself when C++ has them.
On 2014-01-29, at 12:13 PM, Abdul Sowayan <email@hidden> wrote:
>> Are there any current docs that my search didn't find and that you can point me to?
>> Or advice you can offer to help me?
> Well, I’m not clear as to what information you’re trying to find. Can you elaborate?
> Abdul
In answer to Abdul's question there a a few things that immediately come to mind:
The 2005 paper by Josh Anon (I have a pdf) mentions
(0) "The next thing to notice is that we’re mixing #import and #include
directives here. It’s not a problem at all for the compiler.
In fact, we could use:
#import <iostream>
and things would be fine. Actually, using #import is preferable to #include,
because #import automatically makes sure the file’s only included once
as opposed to having to #ifdef files we #include."
Still true?
(1) "Before we begin coding, note that Objective-C++ classes, protocols, and
categories cannot be declared within a separate namespace
(nor can a C++ namespace be declared within an Objective-C++ object)
Everything must be within the global namespace."
Obviously true - no namespaces in Obj-C.
(2) "Just make sure to link against libstdc++ and Cocoa (or Foundation) in your
Xcode project when you write your own code.
Naturally.
(3) "Notice that we’ve intermixed Objective-C’s reference counting memory management
with C++’s memory management. We cannot call delete on an Objective-C object,
and we cannot call -release on a C++ variable.
True even with ARC.
(4) When do we need to use ifdef cplusplus or ifdef objc these days?
etc...
thanks
Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden