• 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: Objective-C vs. Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C vs. Java


  • Subject: Re: Objective-C vs. Java
  • From: Art Isbell <email@hidden>
  • Date: Thu, 26 Jul 2001 09:18:09 -1000

On Wednesday, July 25, 2001, at 02:59 PM, Mike Shields wrote:

On Wednesday, July 25, 2001, at 06:17 PM, Art Isbell wrote:

On Wednesday, July 25, 2001, at 02:02 PM, Mike Shields wrote:

The one thing I'm looking for is Stack-based objects so I can use scoping to automatically cleanup allocated resources (memory, open files, etc). It's the one thing I miss from C++ (other than variables anywhere, but you can get around that pretty easily with brackets)

You won't be finding them in Objective-C even after the ObjC++ compiler is available. Autoreleased Objective-C objects are almost equivalent to stack objects in that they are automatically deallocated.

Duh what?

Why wouldn't I get Stack-based objects? I'm not expecting ObjC stack based objects, but C++.

Read what I said: "You won't be finding them in Objective-C even after the ObjC++ compiler is available." I said nothing about C++ stack objects.

Then I'll be able to combine the best of C++ with Obj C and be a happy happy boy.

I do not know what the upcoming ObjC++ compiler will support, but based on past ObjC++ implementations, I can guess.

You won't be able to use C++ or any C++ features for View objects because Cocoa supports only Objective-C objects. Using C++ for Controller objects would be difficult because these are frequently archived in nibs, and archiving of C++ objects isn't supported. The implementation of Objective-C Controller objects can message C++ Model objects, but you won't be able to allocate Objective-C objects on the stack, for example. You've got to do funky things with #include statements in these ObjC++ files - can't recall the details, but you'll need to surround them in some sort of preprocessor directives.

But your Model objects can be pure C++ if you like, so you can take advantage of C++ features in these objects (well, at least what gcc supports - C++ doesn't seem to be very standardized among various compilers).

ObjC++ will provide enough functionality to allow you to use your C++ Model objects in Cocoa projects which is its intended use. I expect that as you learn what ObjC++ supports, most of you will minimize your ObjC++ source.

Art Isbell
Apple iServices Technical Support
http://www.apple.com/iservices/webobjectssupport/
+1-808-591-0836


References: 
 >Re: Objective-C vs. Java (From: Mike Shields <email@hidden>)

  • Prev by Date: (Semi-OT)GDB Breakpoints on StdErr
  • Next by Date: Re: Memory limitation of NSScrollView
  • Previous by thread: Re: Objective-C vs. Java
  • Next by thread: Re: Objective-C vs. Java
  • Index(es):
    • Date
    • Thread