![]() |
| | #1 |
| Registered User Join Date: Aug 2004
Posts: 77
| Mac OS X Programming Cocoa uses something called Objective-C, which is Apple's enhanced C language, not sure why they didn't use C++ since its already pretty popular and includes the object oriented stuff that was included in Objective-C. There may be more there, I'm not keen on learning another language (particularly a proprietary one) for a platform I'm not sure if I'm going to keep using. Carbon is a straight C API. However, it appears that its an intermediary API for those converting from the old Mac OS API's. Which kinda sounds like Apple will keep it around until everyone is up to date then drop support, thats just speculation by me though and I've been labeled cynical before. So whats the deal? Anyone know if OS X has a C or C++ API that is guarenteed to be supported in the forseeable future? |
| Exile is offline | |
| | #2 |
| Registered User Join Date: May 2004
Posts: 1,362
| Are you looking to make GUI apps?
__________________ |
| sand_man is offline | |
| | #3 |
| Registered User Join Date: Aug 2004
Posts: 77
| Thats definately on the list. Most of the things I've programmed of late were various utilities and the like, so I have a requirement for threads, sockets and file/directory access as well. |
| Exile is offline | |
| | #4 | |
| I like code Join Date: Apr 2004
Posts: 131
| Quote:
I've done a few projects for class in Obj C and personally I prefer it to C++. I wish it was used more than it is. Also, I have a few friends that program Cocoa apps. They seem to enjoy it and think it is worthwhile, although I've never heard them mention Carbon. | |
| Rouss is offline | |
| | #5 | ||
| Registered User Join Date: Aug 2004
Posts: 77
| Quote:
These headers, is it like including iostrem where it allows non-standard lookging function calls like cin and cout? Or do they simply add additional functions? Since Objective-C is object oriented I imagine they have to be adding more than just additional functions. I've also heard some talk about Objective-C++ where its Objective-C but also lets you use all of C++ as well. So I guess Mac does permit C++ programming. I guess the question then becomes how different really is Objective-C from ANSI C? If its just a a few headers, it hardly seems worth renaming it. Quote:
| ||
| Exile is offline | |
| | #6 |
| pronounced 'fib' Join Date: Aug 2002
Posts: 2,289
| mac definitely allows c++ through g++ and X programming. Granted it isn't old school mac programming, but they've gone in the bsd direction for a reason.
__________________ "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter |
| FillYourBrain is offline | |
| | #7 |
| Crazy Fool Join Date: Jan 2003 Location: Canada
Posts: 2,596
| >>Which kinda sounds like Apple will keep it around until everyone is up to date then drop support, <my-opinion>Mac will never drop carbon</my-opinion>
__________________ jeff.bagu.org - Terrain rendering and other random stuff |
| Perspective is offline | |
| | #8 | ||||
| I like code Join Date: Apr 2004
Posts: 131
| Quote:
Quote:
And really all the header does is allow a few new functions and data types, and allow a few new syntactical ways of dealing with objects. I think they are based on the way smalltalk handles objects. Such as Code: id MyObject; /*id is basically a void pointer that CAN be dereferenced*/ MyObject = new ObjectClass; /*make a new instance of ObjectClass*/ /* could also be written */ ObjectClass *MyObject = new ObjectClass; \* or something like that */ /*to call object methods looks like this */ [MyObject MethodName:Argument]; /*Calls MyObject method MethodName, and passes it Argument ] */ int myNum; myNum = [MyObject MethodThatReturnsInt:Arg]; /*This calls an object method that returns a value, and I am storing the value in myNum.*/ /*and when you're done you have to free the object*/ [MyObject free]; /* you can even overload the free method */ Quote:
Quote:
| ||||
| Rouss is offline | |
| | #9 | |
| Just one more wrong move. Join Date: Aug 2001
Posts: 3,232
| Quote:
__________________ Gays can't love like real people entropysink.com -- because arses weren't designed for running websites. | |
| -KEN- is offline | |
| | #10 | ||
| Registered User Join Date: Aug 2004
Posts: 77
| Quote:
Quote:
Thanks for all the details on that, I haven't seen much that gives the low down on this stuff. That clears up a lot of the questions I had on Objective-C. | ||
| Exile is offline | |
| | #11 | |
| I like code Join Date: Apr 2004
Posts: 131
| Quote:
| |
| Rouss is offline | |
| | #12 | |
| Registered User Join Date: Aug 2004
Posts: 77
| Quote:
The Mac compiler (not necessarily the gcc port to OS X, I'm not sure what it will take) will handle C, C++, and Objective-C all in one source file. Naturally you have to include all the required headers and libraries to make it work. Hope that clears up what I was saying. | |
| Exile is offline | |
| | #13 |
| I like code Join Date: Apr 2004
Posts: 131
| So you could include <stdio> and <iostream> and write a hybrid c/c++ program? Is this just a Mac thing, or is it true of all versions of gcc? I guess I could test that question myself. I don't write much c++ anyway, so it doesn'y really matter. |
| Rouss is offline | |
| | #14 | |
| Registered User Join Date: Aug 2004
Posts: 77
| Quote:
| |
| Exile is offline | |
| | #15 |
| Registered User Join Date: Apr 2004
Posts: 21
| Maybe I can help on this one. Cocoa and Objective C are nothing but systems to communicate with a UI made with Interface Builder. You can use C or C++ in your ObjC files, by suffixing your files with .m or .mm. Cocoa was created with fast Mac OS X programming in mind, and does not work in Mac Classic. Carbon is a straight C or C++ file that uses much more code to communicate with the user interface. Carbon requires much more code, but in return there are many more things that you can do with it, and it runs in Mac Classic. You can mix Carbon code into Cocoa code, but you cannot use control the same UI with the two different codes. Carbon probably won't be replaced any time soon. There is a lot more info on the Apple Developer Website. |
| OSDever is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| running binaries built on Mac OS X 10.4 on Mac OS X 10.5 | rak1986 | C Programming | 1 | 02-03-2009 04:45 AM |
| Mac OS X aliases | rak1986 | C Programming | 4 | 01-21-2009 12:11 PM |
| inquiry from a hungry mac os x user | terabyter | C Programming | 3 | 06-23-2006 09:04 AM |
| Mac OS X Users/C programmers? | petermichaux | C Programming | 15 | 12-01-2003 10:35 PM |
| Assembly & Mac OS X | kristy | Tech Board | 2 | 07-29-2003 04:29 PM |