Archived

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

C vs. C++

This topic is 5566 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

well basiclly is it better to go all C++ or use a mix of c code and c++ for DX. If the answer is to use C does anyone know of any good C touts? and also would it be smart to completly learn C before i try to dive into C++ At the moment im attempting to learn C++......Pointers Suck. So any input would be greatly welcome

Share this post


Link to post
Share on other sites
Pointers are same in both languages. It's possible to use DX in C, but it's easier to use C++. As someone who uses C rather than C++, I say go ahead and learn C++, just don't pretend that means that you know how to code in C too. The languages are similar, but that statment is akin to saying - don't think that you know how to speak Latin because you know how to speak Italian. (it does give you a leg up however).


[edited by - lessbread on September 11, 2002 11:08:05 PM]

Share this post


Link to post
Share on other sites
Yes yes it was a joke. Just forgot that damn smiley.

DM0407:

"At the moment im attempting to learn C++......Pointers Suck. So any input would be greatly welcome"

You''ll still need to learn the concept and use of pointers. Clench your teeth and continue learning. And, well, since you''re learning C++, just go for C++.

Share this post


Link to post
Share on other sites
I''d suggest learn C first, but don''t stay there for a long time and don''t learn it completely. Otherwise you will be puzzled while everybody is talking about OOP.

C++ can greatly reduce your programming time, so it''s very important to learn. Learn C first to grasp the structure of the language (the dreaded semi-colons, preprocessors, pointers, bla bla bla), after that, go to C++.


My compiler generates one error message: "does not compile."

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Start with Accelerated C++. It gets your programming fairly advanced stuff early yet manages to hold off teaching pointers until later. The reason? Unlike every other "C++" book Accelerated C++ is actually a C++ book, not a C or java book pretending to be a C++ book.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well, I recommend that you learn a little bit of C just so you can understand it when you come across it also, some functions in C can come in handy, but you don''t need to learn all of it, just have some vague knowledge of it, and you can go hard at learning C++. I''m do that myself but I''m still in highschool and lack time to learn as much as I would like but its working for me...

Share this post


Link to post
Share on other sites
For engine programming, I would suggest you use C++ for the difficult things, and C for the easy things.

As I have been told (don''t let me fool you into thinking I am not capable of carrying incorrect information), C++ handles ''hard'' tasks better than C, but C handles simple things (simple things like physics ;p) better than C++.

You should learn C to the extent in which you so desire to learn. [not a flame]John Carmack... *sigh*. If you think John Carmack is the greatest programmer of all time you have poor priorities.[/not a flame]

Share this post


Link to post
Share on other sites
A programming language is a tool to get something done. Whether you use C or C++ or Java or even a dialect of BASIC depends on what you want to do.
Want to make a prototype to see how something works? Use BASIC, which allows you to code something really quickly.

As for C/C++/Java, I know that among them C++ is the most versatile in terms of what you can do. Java IS Object-Oriented. C++ can be, but can also be C-like in its nature. C++ was designed to allow multiple paradigms, and that is probably why so many people swear by it. They can claim that they like it because it lets them do X, whereas some other language can only do Y. But then still other people will instist that C++ also does Y.

Forget the language. The language is only important as it is the specific tool you use, but if you can''t use general categories of tools, you can''t do anything with it. When you learn to drive, you learn how to turn, how to brake, how to accelerate, how to park.
You don''t learn how to do this ONLY in a certain type of car. You learned how to do it so that even if you were driving an automatic or a stick, you could still control the car and make it go where you wanted to go.
Now you might have to learn how to control a stick, but the point is that it is a detail. Driving a car is still driving a car. The stick is a tool you use to make the car go, but an automatic does the same thing. Think of it like C++ and Java. Java is the automatic that controls what goes on under the hood pretty seamlessly (garbage collection comes to mind) whereas C++ allows you to have more control over what happens by using a manual transmission method.

If you can program in an Object-Oriented way, then you will be able to pick up C++ AND Java AND ML, etc.
Procedural/modular coding: C and C++
Again, C++ is pretty versatile in what it can do. It also makes it more complex to learn/debug, I guess, but then familiarity with your compiler is a good way to help alleviate any pain there.

Share this post


Link to post
Share on other sites
DRAT! All of my post was lost due to a connection problem... well anyway here goes again:

In reply to GBGames:

Do you really consider C++ a manual transmission?


In reply to DM0407:
'Does anyone know any good C touts' here:
http://rocs.acomp.usf.edu/tut/c.php


/*-=-=-=-=-=-=-=-=-=-=-=-=
trae@illicitstudios.com
=-=-=-=-=-=-=-=-=-=-=-=-*/

[edited by - taciturn on September 13, 2002 1:27:34 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by GBGames
Procedural/modular coding: C and C++



C can do some OO stuff too with structs, and you can use function pointers to fake methods as well.

Any more advanced OO concepts such as inheritance can''t be done in C though.


Henrym
My Site

Share this post


Link to post
Share on other sites
I am a noob (obviously) and I''m a little short on money . I downloaded the Bloodshed-Dev-C++ compiler and was wondering if this compiler is any good. Another question If I learn c++ with Microsoft Visual c++ will I be ablem to use that on Dev-C++. Last is there a difference between Visual C++ and C++

Ishamael02
Betrayer of Hope
Eldar_mage
Peter B

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
On the topic of having a vector of strings and ints... just use std::string instead of char* - don''t make things more difficult for yourself than you have to. You''ll end up with memory leaks if you forget to free up strings that have references held in the vector.

Share this post


Link to post
Share on other sites
quote:
Original post by henrym
Any more advanced OO concepts such as inheritance can''t be done in C though.



Inheritance and polymorphism can be done in C too - but it''s messy.

"Object Oriented Programming in C" Laurent Deniau - June 01, 2001

Portable Inheritance and Polymorphism in C by Miro Samek December 1997, EmbeddedSystems Programming

Share this post


Link to post
Share on other sites
quote:
Original post by Ishamael02
I am a noob (obviously) and I''m a little short on money . I downloaded the Bloodshed-Dev-C++ compiler and was wondering if this compiler is any good. Another question If I learn c++ with Microsoft Visual c++ will I be ablem to use that on Dev-C++. Last is there a difference between Visual C++ and C++


Dev-C++ is really just an "integrated development environment" (IDE) - an interface for the compiler - in this case the MingW version of gcc. As far as C++ the language goes - the gcc compiler will be more conformant to the standards.

Visual C++ is also an IDE. The Visual part pertains to the presence of many tools for graphically designing an application. MSVC6 had a few problems conforming to the standards - mostly regarding templates. If you''re just starting to program, it will be a few months to a year before you get far enough along for this to raise it''s head. But if you''re using Dev-C++ you won''t likely have to face that issue at all - but you''ll have other ones no doubt - that''s just the nature of the beast.

Share this post


Link to post
Share on other sites