Advertisement

C/C++ argument crap and a few questions

Started by May 27, 2000 04:18 PM
4 comments, last by GreG_K 24 years, 9 months ago
OK, I got the book "Tricks of the Windows Game Programming Gurus" and I''ve realized the book''s code is 100% C code, except for a few lines of C++ used with the DirectX stuff. What I''m going to ask is, If I learned C++ first, how would I know how to do the "C" code in that book? Most people say C++ teaches you C, C++ DOESN''T teach you C, in fact, most books I see leave as much C style stuff out as they can.And another thing, why SHOULD I learn C++? In the book it says not too use too many of the new technologies, and that C++ is a language of "black boxes" and can really screw your game up if you don''t know what you''re doing, and it also said you should only use it if you''re a seasoned professional.Another thing is the SIZE of the language. Yeah, you would say, who cares you don''t have to learn it all, but it must take 2-3 years to completely learn C++ whereas learning C takes MUCH less time. Another thing is, if in C++ you''re thinking of objects, what''s it like thinking in C? And all these arguments telling me C programs are hard to maintain, there are way too many, I wanna hear from some C programmers to see if these are true, I''m not cracking on either language, I just need some UPS and DOWNS so I can make my choice. It would probably be depending on what I want to do, and naturally, someone who comes to gamedev.net would be interested in making games -Very confused newbie (GreG_K) gknudson@nbnet.nb.ca
Greg K.
C++ is the same as C and then some more. If you don''t know C, you can''t do C++ for sure!

And I''m sorry but I have to disagree with the writers of that book! If there''s a good place to use object oriented programming - it''s in game development!

With "C++ is a language of "black boxes"" is meant that you use private functions & vars. This way hiding stuff that''s not important from the outside of the object. If some time later you''re reusing the code, you don''t see this private/internal stuff, and will make using it much easier!

An objecttype (class) is like s structure/record, with some functions added.

So - Don''t believe em! - Learn C first - C++ is a great language, and will aid you in your design -

Advertisement
quote:
Original post by baskuenen

C++ is the same as C and then some more. If you don''t know C, you can''t do C++ for sure!

And I''m sorry but I have to disagree with the writers of that book! If there''s a good place to use object oriented programming - it''s in game development!

With "C++ is a language of "black boxes"" is meant that you use private functions & vars. This way hiding stuff that''s not important from the outside of the object. If some time later you''re reusing the code, you don''t see this private/internal stuff, and will make using it much easier!

An objecttype (class) is like s structure/record, with some functions added.

So - Don''t believe em! - Learn C first - C++ is a great language, and will aid you in your design -







Yeah, but I need to know advantages of OOP programming!
I kinda feel like I''m putting it down before trying it, but I''m just going by this book so far..and I heard it''s pretty hard to learn, oh yeah I''m almost done reading the c programming language by K&R, so I''m not a complete newbie.

what my GAME PROGRAMMING book(Tricks of the Windows Game Programming Gurus) DOES say though, is this.

THE MININUM YOU NEED TO KNOW ABOUT C++
________________________________________
"I am going to cover some new types, conventions, memory management, stream I/O, basic classes, and function and operator overloading, and that''s about it- but beleive me, that''s enough! So, let''s get started..."

is that really all you need?
-GreG_K
Greg K.
Just an opion of mine and you take it with a grain of salt.

The beauty of C++ is your mindset.

I see dozens of programmers that claim to know C++ and basically use it as a procedural solution.

I see dozens of programmers that claim to know C and use it in an object oriented way.

So the comment about the beauty of C++ and your mindset is this: OOP is a radical departure from the classic top down/bottom up procedural way of programming. C++ allows you the flexibility to go whatever way you want when you design a solution. Objects and frameworks or straight forward procedures and functions. Key point here is it let''s YOU decide what YOU want to do whenever YOU want to do it. C can too, but you don''t have the luxury of language constructs built into it as readily as C++ does.

~deadlinegrunt

quote:

THE MININUM YOU NEED TO KNOW ABOUT C++
________________________________________
"I am going to cover some new types, conventions, memory management, stream I/O, basic classes, and function and operator overloading, and that's about it- but beleive me, that's enough! So, let's get started..."

is that really all you need?
-GreG_K



Something someone taught me a very long time ago and has always stuck with me.

quote:
Never take any one persons point of view as bible.


Let time and experience age you some and you can find out if it's true for you too.



Edited by - deadlinegrunt on May 27, 2000 11:28:34 PM

~deadlinegrunt

quote:

The book it says not too use too many of the new technologies, and that C++ is a language of "black boxes" and can really screw your game up if you don''t know what you''re doing, and it also said you should only use it if you''re a seasoned professional.



Up to a few days ago I would have violently disagreed with this statement, until I did a speed comparison between my standard C-coding style functions, and my normal C++ coding style classes. It was not pretty. C++ was about 80% slower.
Needless to say, I was unhappy ( <-understatement ) and I looked for answers.

I found them too, in a book called "Efficient C++". What I learned from that book has led me to agree with LaMothe''s statement in his book. You DO need to be a very professional C++ programmer to squeeze the last ounce of performance out of it, and you DO need to pay attention to your coding style. If you are programming serious things, that need performance, but don''t have that much programming experience, C is probably the better choice.

#pragma DWIM // Do What I Mean!
~ Mad Keith ~
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

This topic is closed to new replies.

Advertisement