WHY C++ OVER ANSI C?
I''m sure its been asked before, but recently I''ve delve deeply into some more advanced c++ and STL, and I''m wondering if it''s even a smart idea to do so.. So far all I really "use C++ for" is making classes. So I''m almost using plain C, since I barely scatch the surface of C++ capabilities.
So I guess my questions are, what is so much better about C++ than ANSI C that everyone needs to use it over plain C?
Are there really noticable performance gains in using C++ rather than ANSI C?
I''m very comfortable with C, but reading about all this advanced C++ stuff is driving me nutty, and I don''t want to waste my time learning/reading/coding it if I could just as well have used plain old C and focused my skills on all the other complicated things..
I know it can''t hurt to learn it, but, I''ll put it off and focus on other things if it''s not going to help me make my programs faster or better..
-DA
this place is lame
It''s all about the inheritance and templates.
Gamedev for learning.
libGDN for putting it all together.
An opensource, cross platform, cross API game development library.
Gamedev for learning.
libGDN for putting it all together.
An opensource, cross platform, cross API game development library.
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.
quote: I''m very comfortable with C...
This is the important part of your post. Use what is comfortable for you . C++ does have some very useful features, but ANSI C is just as able to create quality software.
nuf said.
January 15, 2003 09:13 PM
learn c++ first(all the stuff that seems stupid) and then decide whether or not it is usefull.
somethings may be faster and some slower but c++ allows for much more organized thought and can make your code smaller and will make your code easier to modify
somethings may be faster and some slower but c++ allows for much more organized thought and can make your code smaller and will make your code easier to modify
hmm I guess either way I have nothing to lose.. just time..! But unfortunatly I don''t have alot of that. I wonder if it would be easy to code my project in C now, and then kind of "port" it to be more C++ as I learn more?
I already know enough about opengl/sdl and C to write something, I just wan''t to make sure I''m not missing out on some spectacular features of C++ that would make me feel the need to go and learn all about it.
Ok well lets say (hypothetically.. ) my program is almost all ANSI C but I use some classes.
Is there any certain "amount" of C++ that someone "should" use?
Is that considered bad programming?
I already know enough about opengl/sdl and C to write something, I just wan''t to make sure I''m not missing out on some spectacular features of C++ that would make me feel the need to go and learn all about it.
Ok well lets say (hypothetically.. ) my program is almost all ANSI C but I use some classes.
Is there any certain "amount" of C++ that someone "should" use?
Is that considered bad programming?
this place is lame
quote: Original post by deadaliveI think it's gonna be a tough job. Porting a code from a language to another is not an easy task, even though they are alike. Bugs tend to show off.
hmm I guess either way I have nothing to lose.. just time..! But unfortunatly I don't have alot of that. I wonder if it would be easy to code my project in C now, and then kind of "port" it to be more C++ as I learn more?
Stick with what you know now, and finish your project. Once you are done, go learn more C++, and start thinking what kind of project you can start with the knowledge you just gained.
return 0;
[edited by - alnite on January 15, 2003 11:56:21 PM]
Object orientated languages, like c++, are very very powerful due to inheritence, polymorphism and (encapsulation, though c does that).
I would suggest sticking it out and learning c++ and then venturing into design patterns. For writing things like GUI''s for games etc, having polymorphism as a tool makes the job so much easier.
Having said that, nothing in c++ cant be done in c in another way. And hec, I only use c at work but thats cause I work on a real time system that has evolved since about 1985.
Good luck
I would suggest sticking it out and learning c++ and then venturing into design patterns. For writing things like GUI''s for games etc, having polymorphism as a tool makes the job so much easier.
Having said that, nothing in c++ cant be done in c in another way. And hec, I only use c at work but thats cause I work on a real time system that has evolved since about 1985.
Good luck
------------------------------------------------------
50% of me is a huge nerd! How about you?
50% of me is a huge nerd! How about you?
Well if you *literally* mean ANSI C, here are some reasons:
Variable declarations are restricted to the beginning of function body, before statements (code).
Classes. Period. I don''t think strict C would even let you have functions in structs. Just the ability to not have to pass around a struct pointer manually is an immense weight off your back.
Templates, although the error codes you can get while using them can be turbo-nasty, therefore I avoid them.
Class inheritance. Being able to write code that can do the same things to different types is amazing when you design stuff around it.
there were a few other amazing things that I discovered when writing a non-optimizing ANSI C parser/virtual machine that I didn''t even know about... but they don''t make much difference since noone even wanted to use them in ANSI C!
Variable declarations are restricted to the beginning of function body, before statements (code).
Classes. Period. I don''t think strict C would even let you have functions in structs. Just the ability to not have to pass around a struct pointer manually is an immense weight off your back.
Templates, although the error codes you can get while using them can be turbo-nasty, therefore I avoid them.
Class inheritance. Being able to write code that can do the same things to different types is amazing when you design stuff around it.
there were a few other amazing things that I discovered when writing a non-optimizing ANSI C parser/virtual machine that I didn''t even know about... but they don''t make much difference since noone even wanted to use them in ANSI C!
using c++ correctly will change the way you organise your thoughts and code. it will be slow work porting from c to c++ but it can be done.
refactoring is a method of changing the design of code without changing it''s functionality. It is used in languages like java and c++ but can also be a starting point for moving from a procedural to an object based language. The methods are small incremental changes that make managing change to existing code, managable. This can lead to better, more reliable, more flexible, extensible, easier to understand, even self documenting, code.
refactoring is a method of changing the design of code without changing it''s functionality. It is used in languages like java and c++ but can also be a starting point for moving from a procedural to an object based language. The methods are small incremental changes that make managing change to existing code, managable. This can lead to better, more reliable, more flexible, extensible, easier to understand, even self documenting, code.
There is a "ANSI C++" too.
--------------------------
Rory Gallagher blues will never die.
---------------------------
Que que foi, que que foi, O que eh que hah?
--------------------------
Rory Gallagher blues will never die.
---------------------------
Que que foi, que que foi, O que eh que hah?
--------------------------Rory Gallagher and Chico Science music !!!!!!!---------------------------____||~~~~|/TT
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement