My most unpopular opinion: Modern C++17 is significantly less safe than C.
-
-
Replying to @pcwalton @RichFelker
Although C++ has a lot of gotchas, I did well on Stackoverflow b/c of them, I would be hard pressed to write as maintainable code in C
1 reply 0 retweets 3 likes -
Replying to @shafikyaghmour @RichFelker
C++ may well help you write more maintainable code, but that code can be less safe.
2 replies 1 retweet 5 likes -
Can you please provide an example for something that is common practice, and isn't actively discouraged?
1 reply 0 retweets 0 likes -
References.
2 replies 0 retweets 2 likes -
How are references unsafe? Their C equivalent, pointers, can be dereferenced while NULL, and can be changed on a whim to invalid addresses.
2 replies 0 retweets 0 likes -
*const pointers can't be changed.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @cjdb_ns and
And it's just as easy to hit UB with references, but less obvious that it's possible.
1 reply 0 retweets 2 likes -
I think that is arguable, the most common cases of UB w/ ptrs and refs I am guessing will lagrely overlap but I don't know of any numbers
1 reply 0 retweets 0 likes -
That’s my main issue with C++: it feels safer than C, so people code like it is, but when you you look closely it actually isn’t any safer.
2 replies 1 retweet 2 likes
The false sense of security causes people to not code defensively the way they would in modern C.
-
-
That's like saying a truck is less safe than a bicycle, because you drive them differently.
2 replies 0 retweets 0 likes -
But ... a truck is less safe than a bicycle? Like, orders of magnitude less safe?
1 reply 0 retweets 1 like - 1 more reply
New conversation -
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.