Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ or Objective C

Status
Not open for further replies.

ndogg

Programmer
Feb 7, 2000
156
US
I want to learn an object oriented language, but I hear that going from C to C++ is pretty hard, but it's a lot easier to go from C to Objective C, any ideas? <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
There is no harm to go for C++ after C. Just release the tension from your mind. First look for the concept of Object Orientation. Then read a language. It would be easier then to grasp.<br><br>Thanx<br>Siddhartha Singh<br><A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
I'm not certain that either dialect of C, C++ or Objective C, is a smooth transition to OO software construction.&nbsp;&nbsp;If THAT were my goal, then I would either investigate Eiffel or Java (or, if I didn't mind learning a new language, Smalltalk).<br><br>On Linux there exist SmallEiffel, Java (various dialects), and Squeak as examples of each of these choices.<br>If your goal is merely to broaden your programming experience in a language that contains OO constructs, then the obvious choice is C++.&nbsp;&nbsp;C++ doesn't coerce you into doing OO programming.&nbsp;&nbsp;It is rather like Ada95 in that it allows you to do OO software rather than coercing you.&nbsp;&nbsp;A slow transition to C++ is quite easy, the problem is mapping a course that would lead you to the appropriate destination, and I'm not clear where you are headed, so that's a bit difficult. <i>Still...</i><br>A first step would be to include prototypes for all function calls.&nbsp;&nbsp;With the argument types specified.<br><br>A second step is, wherever possible, replace the <u>#define</u> statement with a <u>const</u>.&nbsp;&nbsp;This allows the compiler to do better error checking.<br>Then one should probably use array indexing rather than pointer arithmetic to the extent possible.&nbsp;&nbsp;(And <b>try</b> to make it complete!&nbsp;&nbsp;That pointer arithmetic is a source of <i>many</i> errors.)<br><br>Beyond that...&nbsp;&nbsp;well it depends on where you are heading.&nbsp;&nbsp;I think that very few folk know the full C++, so you just learn the pieces near what you are interested in as you go.&nbsp;&nbsp;But think about replacing casts with typesafe casting as a possible next step.&nbsp;&nbsp;Type casting always makes me itchy, but typesafe casting &quot;feels&quot; much better.<br>Of course, if you wish to get into OO software, then you will need to learn about the class construct.&nbsp;&nbsp;Basically it's simple, but it ramifies! <br><br>Templates bother me.&nbsp;&nbsp;They are so useful.&nbsp;&nbsp;And they can cause SUCH code bloat!&nbsp;&nbsp;If you have money to invest, look for a linker that strips out dead (unused) code.&nbsp;&nbsp;The gnu compiler is nice to have, but I've seen several comments indicating that it is less than perfectly optimizing.<br><br>Of course, if you <i>do</i> use the gnu C++ compiler, then you don't need to choose between C++ and Objective C, as the same compiler can handle both.&nbsp;&nbsp;I'm not experienced, but I believe that the Objective C language has seen less development in the last decade.&nbsp;&nbsp;OTOH, it is supposed to be more &quot;dynamic&quot;, where C++ is supposedly entirely static at run-time.&nbsp;&nbsp;Which is more advantageous depends on what you want to do, but if you lean toward Objective C, I would recommend that you look at Python before you decide.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top