My most unpopular opinion: Modern C++17 is significantly less safe than C.
-
-
Replying to @pcwalton
So, can you give a concrete example where c++ is "far less safe" than C?
1 reply 0 retweets 1 like -
Replying to @Ernestas_J
Use after free of a dangling reference. Destructors effectively implicitly call free() without you having to write that in the source.
1 reply 0 retweets 1 like -
Replying to @pcwalton
Isn't dangling reference just a "fancy" way of making "use after free". And destructors don't call any memory freeing func explicitly afaik?
1 reply 0 retweets 0 likes -
Replying to @Ernestas_J
They call “operator delete” which frees memory. I explicitly wrote “effectively” there because I knew someone would pointlessly nitpick.
1 reply 0 retweets 0 likes -
Replying to @pcwalton
No they don't? You explicitly have to free resources that are on heap.
1 reply 0 retweets 0 likes -
-
Replying to @pcwalton
They do it because that's the whole purpose of them? How does that have anything to do with destructors in general?
1 reply 0 retweets 0 likes
Smart pointers’ destructors make it easy to get UAF because they are invisibly invoked while references to the memory might exist.
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.