Archived

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

little_red_warrior

C/C++

Recommended Posts

PhilVaz    144
<< Should i learn C first? >>

I say yes. C++ is just C with classes. You don''t need to master classes, or even program with them. Lamothe is straight C, Carmack (Doom, Quake) is straight C.

Phil P

Share this post


Link to post
Share on other sites
Ekim_Gram    418
But if you learn C first you''ll have to break some habits. You''ll understand C++ soon enough. Some things you don''t need to understand to write a good program but it''ll help if you do. Just don''t worry about it too much, everything will fall into place in time.



There''s no town drunk here, we all take turns.
Velocity Gaming Force

Share this post


Link to post
Share on other sites
FtMonkey    122
I say learn c++, c is harder to read like cows said and classes aren''t a bad thing to have around even if you don''t really need them.

Share this post


Link to post
Share on other sites
Colin Jeanne    1114
Any language is going to seem like jibberish when you are first learning it. Since C and C++ are to different languages it really doesn''t matter which you learn first. Since you started with C++ you might as well stick with it.

And why exactly is C harder to read? Seems perfectly fine for me. Perhaps you are just trying to read code from the IOCCC?



Qui fut tout, et qui ne fut rien
Invader''s Realm

Share this post


Link to post
Share on other sites
Makoy    126
I suggest you stick with C++ since you already started learning it. C and C++ are quite similar in a way that they have the same structure.So, that''s it. Stick with C++.

Share this post


Link to post
Share on other sites
quant    100
IMHO i think you would pick up more bad habits by learning C first, so just stick with C++. C++ is, afterall, a language in its own right. You dont have to go past the first line of a program to find a differenec between the 2 languages, e.g. main() in C is not the same as main() in C++, in C () means an unspecified amount of parameters iirc, in c++ it means no parameters. Little things like that can lead to confusion when you start mixing the two.

[edited by - quant on August 6, 2003 5:56:24 AM]

Share this post


Link to post
Share on other sites
Kumppi    122
When I started to program 3 years ago I didn''t understand anything about programming. After looking around a bit I chose C++ as my first language. Some people say that C++ is too hard for the first language, but it didn''t hurt me.

"Life is very short, and there''s no time for fussing and fighting my friend..."

Share this post


Link to post
Share on other sites
mputters    126
I wouldn''t say C++ is just C with classes. And as far as reading C code, I''d say it''s quite easier than looking at the STL headers ;p

I personally think learning C first is not a bad thing, especially since it will teach you many algorithms at the same time, since most people tend to use STL when they need simple stuff like linked lists, vectors and others (which is a good thing when programming, but not when learning, imho).

Share this post


Link to post
Share on other sites
mputters    126
As for Lamothe and Carmack :

Lamothe attempts (in his last book) to make people think he knows C++ but starts with including iostream.h (commenting it''s for important stuff, very nice info thanks) then not using anything from it.

Doom 3 is C++.

Share this post


Link to post
Share on other sites
Nik02    4348
I started programming 12 years ago with qbasic.
Then, intriqued by the possibilities of c++, i began slowly converting my projects to the said language (with borland c++ 4).

Now, i'm a successfull freelance agent, in graphics programming.

All it took was some reading, and some practice.
Note, by 'some' i mean a lot

EDIT: not sure about the c++ version, it's so long ago...
And, i still need to read and experiment a lot

[edited by - Nik02 on August 6, 2003 7:40:06 AM]

Share this post


Link to post
Share on other sites
RS_Hybrid    122
quote:
Original post by little_red_warrior
I am learning c++ but it all still seems like a whole lot of gibbrish to me. Should i learn C first?

«—Ļĩŧŧłę–Ŗęđ–ЩдґґÎðr—»


Personally i don''t think it would hurt if you familiarized yourself with C before truly moving onto C++. The reason why it seems a lot like gibbrish is because you''re new to programming in general. Don''t forget, programming wasn''t ment to be easy, as they say "true programming is an art" . Besides even if it all seems like gibbrish, that''s the nature of the language for a noob, I felt the same way at first too, it takes some time to get a ''feel'' for the language, but if you ask me i think c and c++ are both beautiful languages

no theory`

Share this post


Link to post
Share on other sites
QzarBaron    370
Carmack was straight C. Resently Id has now started working with C++ for Doom 3. Carmack says he sees more efficiency and structure in C++. Any way i like C and i use it alot. Athough i like the organization that OOP brings. You should stick to C++. But also learn C. They are not much different. I read C in 21 days to learn C. just basic C. But i will use C to make games. I just think that C is much simpler for game development. Also learn C++ though you will need it alot.

Share this post


Link to post
Share on other sites
sSimontis    100
C is older. Many of the features that C++ has C doesn''t support. Also, some people who learn C first develop bad coding habits. At first, I felt the same. I didn''t understand it, and would drift off because it seemed too confusing. I got C++ for Dummies, and it was a lot easier. The book isn''t dry at all, is easy to understand, and well written. Plus, it comes with GCC and rhide.

Scott Simontis
Big Joke: C#

Share this post


Link to post
Share on other sites
rohde    432
If you want to learn C++ there is no way in hell you should start by learning C. There just simply isn't. All the time you spend on learning C could be spend on being extra good with C++.

C is very different than C++:

In C++ you should program using the STL. C does not have the STL.
C++ is a multi-paradigm language. C is mainly procedural.
C++'s memory management is very different than C.

If you start with C, then you'd have to unlearn a plethora of stuff when moving on to C++.

Believe me, if C++ is gibberish to you, so will C be (if not more). It seems you need a good textbook on C++. Get Deitel & Deitel's "C++ How to Program". It's excellent for newbies.

So, get a good book on C++ and start coding and forget about C.

Or, as flangazor wrote, learn Scheme



"Yeah, I would've killed you, but I'm glad I didn't - the paperwork is a bitch"

[edited by - rohde on August 6, 2003 9:05:44 AM]

Share this post


Link to post
Share on other sites
Way Walker    745
quote:
Original post by Invader X
Perhaps those of you who list "C causes bad habits" in your argument against C could enumerate some of these habits? Stating that C caused bad habits isn''t enough.



I always thought it was commonly accepted that good habits in one language tend to be bad habits in another. For example, most people are saying "If you learn C before you learn C++ you''ll have to unlearn some bad habits", but it''s equally true if they were to say "If you learn C++ before you learn C you''ll have to unlearn some bad habits", or even "If you learn Ada before you learn Lisp you''ll have to unlearn some bad habits".

I guess here''s a for instance. In C it''s recommended to use #define''s for constants while in C++ it''s recommended to use const variables for constants. In C++ you have to cast void pointers (the language makes you so that it can detect a certain class of errors) while in C it''s recommended that you don''t cast void pointers (so that the language can detect a different class of errors).

Also, "C++ is a superset of C" became even less true with the C99 standard. C99 adds the inline keyword, but it has a slightly different meaning (The function definition defaults to extern, while in C++ it''s static). It also has designated initializers (to make up for a lack of constructors, I assume), compound literals (which lets you pass a pointer to a literal), and VLA''s (the only instance where sizeof is computed at runtime).

Finally, my suggestion to the OP would be to learn Java first, then C++. Java is in many ways a stripped down C++ with a focus on OO. Thus, you will learn OO skills (which is the favored paradigm of C++). As an added bonus, object variables in Java behave very much like pointers in C++ so you won''t have the common problem of trying to understand what a pointer is.

Share this post


Link to post
Share on other sites
RikeyFitzer    100
I say don''t learn either of them. I was learning C, and I can tell you that language is no good. I could probably say the same for C++, because I did a little bit of that also. Both of them are tough languages to use. And usually only large development teams use C/C++ for projects. It takes far too much time for a single programmer to write so much as a text editor in C/C++. Look at all the fellow programmers around you who use C++, they don''t have anything done. Some of them have been working on their projects for years.

A better genre of languages for a single programmer like yourself, would be the BASIC programming languages. Blitz Basic, Blitz 3d, Dark Basic, Visual Basic are the best that I can remember off the top of my head.

Blitz Basic - Great and super easy for making 2d games.
Blitz 3d - Same guys who did BlitzBasic, only for 3d games.
Blitz Plus - I haven''t used this but... Same guys who did Blitz Basic. It''s like Basic mixed with C (functions and types).
Dark Basic - For 3d games. I prefer this to Blitz3d.
Visual Basic - Want to write Win32 apps such as text editors or map editors? This is the one.

Here are the links to the websites for the languages that I made reference to: Blitz Basic, Blitz 3d, Blitz Plus, Dark Basic, Visual Basic

Good luck.

Share this post


Link to post
Share on other sites
TheNerd Tk421    122
Hello,
My question is... well i have been trying to learn C++ for like a month now.. i think my compiler sux cuz it wont execpt much cept for like basic window creation and prompt stuff(like a simple prompt calculator or hello world type apps) and it wont execpt most of the code from this site.. i dont understand it.. i use bloodshed''s Dev-C++ 4.0(cuz i hate command line compilers)and i cant find ne other good free ones... can ne 1 help me?

There is no spoon

Share this post


Link to post
Share on other sites
sSimontis    100
Dev-C++ is great. I use it for all my development. It has some weird stuff, but I got used to it in 20 minutes or so. Try the mailing list. And I would like a description of your problem to help out. I find Dev-C++ perfect for OpenGL, Win32, DOS, and Allegro programming. Sometimes, I use DirectX with it!

Scott Simontis
Big Joke: C#

Share this post


Link to post
Share on other sites
Shannon Barber    1681
The only bad thing about DevCpp is that it dones't have a GUI designer like the professional tools do.

Go get wxWindows and use that for your GUI - a couple of trail-ware designers are available for it, and it's not too hard to hand code it either.

For a single person starting-out, I think I'd have to agree that a tool designed for the job (like Dark Basic) is going to be much faster at getting some results. When it changes from getting 'some' results to getting exactly what you need, then it's time to write C++.

PS The DooM III graphics engine was written in C by Carmack, and the other peopple who put the finishing touches on wrote the rest in C++. Carmack intends to continue to program in C.

- Magmai Kai Holmlor

"No, his mind is not for rent to any god nor government" - Rush, Tom Sawyer

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]



[edited by - Magmai Kai Holmlor on August 6, 2003 8:54:09 PM]

Share this post


Link to post
Share on other sites