C/C++ Learning

Started by
13 comments, last by ServantOfGlaaki 22 years, 1 month ago
Ahh, but therein lies the beauty of C++; if you don''t want to use OO techiniques, you don''t have to.

C++ allows you to write programs in many different styles. You can use OO techiniques, if you want to, with full-blown multiple inheritence. Or you can use a subset of those with single inheretence. Or you can use generic programming techiniques with templates and the STL. Or you can use procedural programming techniques, like C. You can write structured programs, or have spaghetti GOTO logic.

In short, even if you used C++ to program as you would in C, you would still be better off because of strong type checking, const/inline functions instead of macros, better string(no char* pointer madness), and all the other cool little things that c++ provides.

Consider teaching a new C user how to read in a string from the keyboard and print it out. You have to mess with low-level memory, and it fails on inputs that are too large, and all these other little things.

In C++, however:

string s;
cin>>s;
cout<
It''s much more readable and conducive to learning.
Advertisement
If you learn c++, you know c ( or can learn it in a day ).
daerid@gmail.com
quote:Original post by Anonymous Poster
Since when are OO features easy to use, have you read these forums?!

That''s not quite what I meant. I meant that it makes it easier to use OO features, but not that it is easy to use OO in general. It''s probably more a matter of opinion on whether or not OO is easy to use. Considering he''s coming from Java, OOP is probably ingrained in him. It''s kind of hard to explain what I meant, but it''s not what you think I said .
quote:Original post by SilentCoder
In your first post, are you trying to say that I should begin with C++, and move on to C, and that C is better? Surely this can''t be true, as (the way I see it, which is almost certainly wrong ) C++ is a more advanced version of C. Can C do GUI-type-stuff (i.e. with a RAD)?

I think everyone should know how to use both C++ and C. They''re not very different, and being able to use both can''t hurt. If you''re wondering about functionality: anything you can do in C you can do in C++ and vise versa. If you ever have to program for a platform that doesn''t have a C++ compiler (the exist ) or company that doesn''t want to use C++ (lots of these exist), then knowing how to work without the features C++ adds would be a huge advantage . This is also hard to explain, I''m probably doing a poor job, heh.

Okay, so C++ seems the better choice I think . One other thing: I know for a fact that Microsoft Visual C++ can use the DirectX API (as an example) in a Windows app. Would CBuilder be able to do the same? What I am trying to get at is are some things such as DX designed for a certain IDE/RAD (i.e. MS VC++), or are they like java packages in that I just have to include the compiled files, import them (in a C++ like way), and then use them? In other words, can some IDEs/RADs use APIs that others can''t?
And a woman needs a man... like a fish needs a bicycle...[U2 - Tryin' to throw your arms around the world]
Yes, C++ probably is the better choice for a Java programmer. Just keep C in mind.

No, API''s and libraries aren''t designed for only a single IDE. However, sometimes the way they''re designed can limit them to a single compiler and/or linker. BCB comes with some tools (implib, et cetera) to help you convert the MSVC-formatted libraries to BCB-formatted libraries. However, since DirectX''s libraries are pretty weird, this may not work for some of them (I think DirectInput is the part everyone has problems with, D3DX is another).

You can download pre-BCB-formatted libraries for DirectX somewhere (try a search engine) but Microsoft no longer releases them.

This topic is closed to new replies.

Advertisement