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

coastertux

macrumors regular
Original poster
Jul 17, 2006
155
0
I am taking a C++ programming course at my university in the Fall but it is geared towards Windows programming. How easy will it be for me to transfer my knowledge to programming on Macs? Where can I find more info on this?
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
I am taking a C++ programming course at my university in the Fall but it is geared towards Windows programming. How easy will it be for me to transfer my knowledge to programming on Macs? Where can I find more info on this?

C++ is the same on Mac as it is on PC, THe only thing you'll have to watch out for is having certain header files or that. Now as for API difference, with Windows you'll mainly have to program a lot of it in unless you use a GUI builder, whereas with Mac's its all builtin and no immediate linking is needed. I've programmed WinAPI on PC and have built apps on mac os x, Mac's are sincerely easier, but if you have the help of a GUI builder then you'll be fine, the transition will be different cause you'll have DWORDs etc. and tha tand won't have the common use of NSObject as being yoru main Object which really sucks in the long run. I think it won't be that bad, but it won't be extremely easy either.
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
Uhh no. C++ on the Mac is not like C++ for Windows, unless you are doing the most basic of C++ programs that use a terminal for input and output. If the OP is doing actual VC++ work, then they are not using a C++ compiler, but a Microsoft C++ compiler which is different. Next if they are having to build forms, then you can forget about making the code cross-platform. It would be the same as loading up Objc-C in VC++ and trying to compile that.
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
Uhh, no.

Microsoft Visual C++ is not Ansi C++. They have made that obvious from the start. It doesn't handle the standard libraries except in VC++ 2005 in a normal fashion. VC++ was designed to build Windows applications, not as a C++ compiler.
 
I am taking a C++ programming course at my university in the Fall but it is geared towards Windows programming. How easy will it be for me to transfer my knowledge to programming on Macs? Where can I find more info on this?

The same style of thinking that you use in order to make certain programs with windows should apply to other programming languages and other platforms. What's usually new is the language grammar and the API. For example, some languages do not use loops, and rely completely on recursion. So to answer your question, you should be able to transfer your knowledge of program design, but you may have to learn a new API.

Hope this answers your question.
 

Torajima

macrumors regular
Jan 6, 2004
241
0
USA
I am taking a C++ programming course at my university in the Fall but it is geared towards Windows programming. How easy will it be for me to transfer my knowledge to programming on Macs? Where can I find more info on this?

If you're taking an intro to c++ course, it doesn't matter what you write the code on, Mac, Windows, or Linux. You can try the program on the Mac by compiling in Xcode, and then take the source code to class and compile again with whatever compiler they're using in windows.

The programs should run exactly the same, at least until you take a more advanced course involving graphic user interfaces.
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
Uhh, no.

Microsoft Visual C++ is not Ansi C++. They have made that obvious from the start. It doesn't handle the standard libraries except in VC++ 2005 in a normal fashion. VC++ was designed to build Windows applications, not as a C++ compiler.

MVC++ is not Ansi C++ true, but C++ syntax is the same on all OSes MVC++ is not C++, C++ is C++, MVC++ is MVC++, that's my personal opinion.

Just lay down the basics, try not to confuse the poor guy, we could get into versions of C++ Compilers? GCC, Microsoft, Borland, etc. Just kidding =P lets not seriously
 

Columbo X

macrumors member
Jun 10, 2007
62
0
UK
Programming knowledge is fairly transferable, as has been said above. It's largely the differences in APIs or syntax that can cause problems.

If you're going to port code between the two platforms, one thing I would advise is you check out the Model-View-Controller design pattern when thinking about your code design. I first came across this when looking at Cocoa development when OS X 10.0 first came out. Apple have a load of documentation about this on their developer web pages. The nice thing about orgainising your code around this structure is that non-OS / API specific stuff can be ported directly with no/minimal changes. The OS / API specific stuff can then be implemented as required. For instance, I'm currently porting a lot of Win32 code to Cocoa. In developing the Windows code, I stuck to the Model-View-Controller structure. I've written the Windows code so the Windows-specific WinMain and WndProc event handler make up the controller / view side and the rest of the code (classes for first person cameras, fractal landscapes etc) are written using C++ without any need for Microsoft-specific stuff.

Porting is then quite straightforward. X-Code and Interface Builder make it easy to create the relevant interfaces and the C++ stuff can be ported across with minimal changes (usually only include statements have to be changed). On the Mac side of things, Objective-C++ is very useful and makes this process far easier as your C++ classes can be linked directly to the Cocoa interface.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.