Compiler Status Review Stream happens in 3 hours, at 3pm Pacific time!
-
-
Like Jon I think that 75% of the cruft and perf mess in C++ is to do with constructors and destructors. I think they get badly abused - RAII shouldn't be quite so literal. I mainly use them to set up error values to spot when I didn't call Init()/Fini() correctly.
-
Isn’t 75% of all power of C++ in destructors, too?
-
I mean technically yes because it's the 75% of C++ that is awful and needs to be nuked. Look - all that stuff, other languages do much much better, and C++ can never be that great at it because legacy, but the language designers spend so much time trying to make it work.
-
If you want constructors to be this awesome powerful one-line-of-code-does-your-whole-ago then you need to go much higher level - get a GC, build a lot more type inference into the language, etc. Don't start with a language originally designed for low-level OS and perf!
-
What exactly do you mean by this "powerful thing"? C++ ctors/dtors just make it possible to afford not having a gc, they're not that fancy.
-
Half the features of every new C++ version is to try to deal with the performance implications of everything-is-a-bloody-constructor.
-
I'm not sure which ones you're referring to... If you mean move constructors / rvalue refs, they aren't for making things faster.
- 4 more replies
New conversation -
-
-
Thank you for not putting constructors in your programming language.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.