Jump to content
  • Advertisement
Sign in to follow this  
Kyall

Is C++ too complex?

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

I always want to improve my C++ knowledge and this time around this means finding out what parts of C++ aren't any good, so I thought I'd field a question to the experts: what parts of the c++ language are too complex to the point they interfere with writing good code and should be avoided as much as possible. Should I always use the stdio and not iostream for example, dynamically allocated memory in classes vs putting it in structs. What's the debate on what parts of c++ improve code, and the other parts that are over complicated and are damaging to code standards.

Share this post


Link to post
Share on other sites
Advertisement

What's the debate on what parts of c++ improve code, and the other parts that are over complicated and are damaging to code standards.
C++ is full of subtle and complex features, but they are only "overcomplicated" relative to incompetent users, not relative to their purpose; there are many good reasons to do things in a certain way, and valid use cases for everything you don't like or understand.

Share this post


Link to post
Share on other sites

[quote name='Kyall' timestamp='1354261356' post='5005610']
dynamically allocated memory in classes vs putting it in structs.


I'm not sure what you mean by that. Maybe stack vs heap ?
[/quote]

I believe he means that member data of a class is either dynamically allocated and referenced with a pointer or else it isn't (in which case it may be global, stack or still dynamically allocated, depending on how the instance of the class was defined).

Share this post


Link to post
Share on other sites
While I personally hope that I never have to deal with goto myself, I have encountered enough "damned if I do, damned if I don't" scenarios to understand that I might be at some point in a situation where goto might be the least evil way to solve something. I hope I won't have to ever use it though - no amount of showers would be enough to ever feel clean again after that.

Share this post


Link to post
Share on other sites

dynamically allocated memory in classes vs putting it in structs.

Classes and structures are exactly the same thing except for default visibility of members and methods. You are asking about 2 unrelated things—whether related information is inside classes or structures does not matter, nor does it matter if it was allocated dynamically or embedded within an encapsulating class/struct. There are combinations of these 2 things suitable for various situations, and there is a time and place for all of these combinations.

It is just common practice to make structures hold “plain old data”, but otherwise there is nothing unique between classes and structures.


The only part of C++ that should be avoided as much as possible is “[font=courier new,courier,monospace]goto[/font]”.
[EDIT]
Damn it Hodgman, beat me to it.
[/EDIT]


L. Spiro Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!