Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RogueZero

C vs. C++

This topic is 5538 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i was talking to one of my friends about c and c++ and he said that i should learn c first in order to understand c++ better. I think he is wrong. He also said that C++ is the best programming language out now. Is he right on both these topics and whats the difference between c and c++?

Share this post


Link to post
Share on other sites
Advertisement
While many will say that there are different languages for different tasks, I will agree with him, C++ is the best language out right now. I am not going to argue with anyone about this, so end it here.

Very few people actually learn C before they learn C++. In C, structures are handled in a funky way with typedef and such, variables can only be declared at the top of functions, and there are really only two types of variables, global and local.

What I find most people learn is actually non-object oriented C++. This is in my opinion the best route. Once you have all of the basics down like variables, functions, operators, and pointers, then start exploring classes and higher level approaches.

Share this post


Link to post
Share on other sites
My opinions:

> he said that i should learn c first in order to understand c++ better

He''s wrong. By learning C first you''ll only learn bad habits that make you write worse C++.

> He also said that C++ is the best programming language out now.

He''s wrong. There are several good languages, all with their own strong points. C++ is not "the best".

Share this post


Link to post
Share on other sites
By learning C first, you have the potential to learn many bad habits that you would have to unlearn if/when you move to C++. Though by learning C first you do get a better appreciation why most people will use C++ instead.

Now as far as C++ being the best language, that is pure opinion. My opinion is it absolutely and completely depends on what you are doing. For some things I''d go with Perl, others Java, and some things C++.

--
Aethon

Share this post


Link to post
Share on other sites
quote:
Original post by 31337
While many will say that there are different languages for different tasks, I will agree with him, C++ is the best language out right now. I am not going to argue with anyone about this, so end it here.

Very few people actually learn C before they learn C++. In C, structures are handled in a funky way with typedef and such, variables can only be declared at the top of functions, and there are really only two types of variables, global and local.

What I find most people learn is actually non-object oriented C++. This is in my opinion the best route. Once you have all of the basics down like variables, functions, operators, and pointers, then start exploring classes and higher level approaches.


Very few? There are TONS of schools that teach C before C++, and a lot of people that go to these schools learn it in this order. I for one learned C before C++, and I know when to use the featuers of C++ and when not to, because just because they make development time faster in some cases, doesn''t mean they make the game run faster . There isn''t really a big downside to learning C, because C++ is pretty much backward compatible.

Share this post


Link to post
Share on other sites
quote:
Original post by civguy
My opinions:

> he said that i should learn c first in order to understand c++ better

He''s wrong. By learning C first you''ll only learn bad habits that make you write worse C++.

> He also said that C++ is the best programming language out now.

He''s wrong. There are several good languages, all with their own strong points. C++ is not "the best".


If only this were 100% true... you may just pick up GOOD habbits along the way too though. I personally learned C before C++, and I think it helped more than it hurt. Sure I have a few habbits left over from C, but not all of them are bad. Just because it''s a feature in C++, doesn''t make it the best choice... some times, plain old C runs much faster than something written using the "advanced" features of C++. I said this above, and I''ll say it again.. just because development time gets faster, doesn''t mean your game will run any faster, and if you never learn C, chances are, you''ll miss out on a few things that may have helped.

Share this post


Link to post
Share on other sites
quote:
Original post by aethon
By learning C first, you have the potential to learn many bad habits that you would have to unlearn if/when you move to C++. Though by learning C first you do get a better appreciation why most people will use C++ instead.



Everyone trying to bring up this bad habbit thing.... name a few bad habbits that you had to "unlearn" in orer to move to C++... void pointers? Organizing data in structures instead of classes? Using functions rather than class member functions? Having to initialize all your data rather than have a constructor do it (I could see how this could screw you up if you went from C++ -> C, but not from C -> C++)? How many of you guys saying you''ll pick up bad habbits learned C first, and have more bad than good habbits? I did learn C first, and I did migrate over to C++. I don''t use ALL the features of C++, but I do know about most of them if I ever find a need for them.

Share this post


Link to post
Share on other sites
quote:
Original post by Ready4Dis
Everyone trying to bring up this bad habbit thing.... name a few bad habbits that you had to "unlearn" in orer to move to C++...


Using true object oriented design instead of "Hey I''m using classes, thus OOP!"

Since C does not directly support OOP when switching to C++ that does, you potentially have to unlearn the habits which would interfere with OOP.

--
Aethon

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by aethon
quote:
Original post by Ready4Dis
Everyone trying to bring up this bad habbit thing.... name a few bad habbits that you had to "unlearn" in orer to move to C++...


Using true object oriented design instead of "Hey I''m using classes, thus OOP!"

Since C does not directly support OOP when switching to C++ that does, you potentially have to unlearn the habits which would interfere with OOP.

--
Aethon


Saying you have to unlearn somethings just because you''re using a different language is like saying you can only learn 1 language and if you switch you have to unlearn it and if you want to program in it again you have to relearn it. C and C++ are different languages.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!