Linked by Thom Holwerda on Mon 13th Aug 2007 17:57 UTC
Thread beginning with comment 263259
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
The things i avoid like anything are:
1. Nested Templates (and in general all templates except STL)
2. Exception handling .... It is so much harder to debug.
3. auto_ptr style memory management - It is never right and when it is wrong, it is nightmare to maintain.
4. Operator overloading - I avoid it mostly .... Use with caution...don't overdo it. ...
5. Crap stuff like virtual constructor etc etc and all the *extra smart* C++ receipes ...
And yeah, if you really want to know how twisted C++ can be, read Effective C++ series.
1. Nested Templates (and in general all templates except STL)
2. Exception handling .... It is so much harder to debug.
3. auto_ptr style memory management - It is never right and when it is wrong, it is nightmare to maintain.
4. Operator overloading - I avoid it mostly .... Use with caution...don't overdo it. ...
5. Crap stuff like virtual constructor etc etc and all the *extra smart* C++ receipes ...
And yeah, if you really want to know how twisted C++ can be, read Effective C++ series.
Nice to see that someone agrees with me... I've been saying this for years, taking the flames. If you need/want a more powerful language than C++, go for it but don't complain when you can't twiddle bits fast or access your system as easily.
Why is it better to write 5 lines of code instead of 25, if:
- it can't be read or maintained even by me
- portability is shaky
- if it doesn't compile, it's easier to switch to the 25 line version than figure out why
- if it doesn't work, it really can't be debugged
- it takes just as long to write and longer to compile.
I do use templates, but I don't nest them; I throw exceptions, but very rarely out of a function; I'm leery of auto_ptr-type things I didn't write; and banning boost from production code was worth it for the saved research time alone.
I call this method "Aim low and SHIP!" and it's served several companies (and me) very well.






Member since:
2005-07-10
I would call myself fairly C++ knowledgeable and i use it often for user mode programming. But once i had to debug someone else's code written in C++ and following were my horrors:
1. templates inside templates inside templates....Nested templates are the worst thing designed in C++
2. Operator overloading - While looking at the code, i really did not know whether a + is a function call that can throw or it is a simple addition.
3. Exception handling - It just makes large project so much harder to debug because you never know once an internal function throw, where the exception will get caught. And the handler that catches the exception usually doesn't have any idea on what to do with it.
4. smart pointer type stuff - C++ doesn't have garbage collection and people shouldn't try to mimic that. With all the auto_ptr crap associated with nested templates, finding where and when an object leaks was a nightmare.
After this C++ experience, i became quite anit-complex-C++. I like some of the features it provides like data abstraction using classes etc but it is becoming increasingly complex.
For myself i only use following C++ features:
1. Basic C features
2. Classes
3. Derived classes with single inheritance or multiple inheritance rarely
4. Well design STL type templates
5. Virtual function where appropriate but not very often
The things i avoid like anything are:
1. Nested Templates (and in general all templates except STL)
2. Exception handling - I hate compiler unwinding the call stack etc. It is so much harder to debug.
3. auto_ptr style memory management - It is never right and when it is wrong, it is nightmare to maintain.
4. Operator overloading - I avoid it mostly but i know for some math related tasks it is nice. Use with caution...don't overdo it. One person overloaded operator >> for sending data on socket and that is too much for me.
5. Crap stuff like virtual constructor etc etc and all the *extra smart* C++ receipes available in some books.
And yeah, if you really want to know how twisted C++ can be, read Effective C++ series. After reading that i realized how complex C++ can get and how to never get in that trap.
Edited 2007-08-14 02:03