Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Acorn

macrumors 68030
Original poster
Jan 2, 2009
2,644
358
macrumors
I consider myself to have intermediate knowledge of c++. When I looked in to what I should know for mac programming it was suggested that I transition to objective c. Since everything on mac is objective c I tend to agree with this. however when I come here I still occasionally see people trying to learn c++ instead of objective c. is there something about mac programming with c++ i dont know about ?? I just dont want to waste my time learning objective c if in the end i find out i didnt have too.
 
I consider myself to have intermediate knowledge of c++. When I looked in to what I should know for mac programming it was suggested that I transition to objective c. Since everything on mac is objective c I tend to agree with this. however when I come here I still occasionally see people trying to learn c++ instead of objective c. is there something about mac programming with c++ i dont know about ?? I just dont want to waste my time learning objective c if in the end i find out i didnt have too.

If you want to use the Apple frameworks, then you need ObjC. Otherwise, it isn't required at all.
 
You'll need at least some Objective-C to glue your C++ code to Cocoa for GUI and other System frameworks. Otherwise you CAN use your C++ code in the same program (referred to as Objective-C++). I would recommend a very clear delineation between your C++ and your Objective-C code to avoid any messy memory management issues, etc.

If you plan to program for OS X or iOS you need to learn Objective-C. Just do it, don't fight it. It doesn't mean sacrificing the C++ you've learned.

-Lee
 
Objective-C++ is great, but it has some caveats. Nothing too complicated but make sure you carefully read them as they can cause problems in very non-obvious ways. For instance you can have a typedef in Objective-C and C++ with the same name but different definitions. This will compile, but trying to exchange data between Objective-C and C++ will often cause silent data corruption.......
 
You'll need at least some Objective-C to glue your C++ code to Cocoa for GUI and other System frameworks. Otherwise you CAN use your C++ code in the same program (referred to as Objective-C++). I would recommend a very clear delineation between your C++ and your Objective-C code to avoid any messy memory management issues, etc.

If you plan to program for OS X or iOS you need to learn Objective-C. Just do it, don't fight it. It doesn't mean sacrificing the C++ you've learned.

-Lee

I want to try and program for ios. I have a book by kochan i will be starting with. hopefully the book isnt that bad.
 
I still occasionally see people trying to learn c++ instead of objective c.

For Mac development, it's mostly ancient legacy code (old libraries) that requires knowing C++. The vast majority of completely new OS X and iOS app development is strictly in Objective C and C.

And if you know basic C++ OOP concepts, getting up to speed in Objective C coding will go much faster than you might think.
 
For Mac development, it's mostly ancient legacy code (old libraries) that requires knowing C++. The vast majority of completely new OS X and iOS app development is strictly in Objective C and C.

And if you know basic C++ OOP concepts, getting up to speed in Objective C coding will go much faster than you might think.

I am hoping so. thanks for the info
 
C++ does have a specific place in Mac OS X, in IOKit. It is the language used for device drivers.
 
For Mac development, it's mostly ancient legacy code (old libraries) that requires knowing C++. The vast majority of completely new OS X and iOS app development is strictly in Objective C and C.

Citation needed. Don't use the same marketing trick Microsoft used when pushing C#. When you read "legacy", they want you to think of "dusty, convoluted, old-fashioned". Instead, whenever a marketeer says "legacy", mentally substitute it with "working, efficient, proven".

There is plenty of fresh C++ being coded daily.
 
Citation needed. Don't use the same marketing trick Microsoft used when pushing C#. When you read "legacy", they want you to think of "dusty, convoluted, old-fashioned". Instead, whenever a marketeer says "legacy", mentally substitute it with "working, efficient, proven".

Well, in Microsoft's case, if we're talking about MFC when mentionning C++, then "dusty, convoluted, old-fashioned" isn't so far off the mark ;)

Heck, straight Win32 in C was easier to grasp than that junk. :eek:
 
Well, in Microsoft's case, if we're talking about MFC when mentionning C++, then "dusty, convoluted, old-fashioned" isn't so far off the mark ;)

Of course. Anything is an improvement over MFC. Unfortunately, I think many programmers who grew up on Microsoft equated C++ with MFC. I grew up on BeOS, and my youth with C++ was quite a bit happier.
 
Yeah... I do all my C++ programing on Windows using C++/CLI WinForms just to avoid MFC.

C++ definitely has a place on the Mac. If you have a cross platform app, using C/C++ is a great way to share business logic and model data between various platforms and reduce your testing/code validation efforts/costs. Also from an employment standpoint, it can't hurt to know how to use C++ in an iOS/Mac project.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.