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 -
Compared to C you can not create a null or uninitialized reference. Pointers and references can both dangle but that is a UB common to both.
2 replies 0 retweets 1 like -
You "can", but it's just via UB. The *only* difference is where the UB formally got invoked tho:
2 replies 0 retweets 0 likes -
Replying to @RichFelker @shafikyaghmour and
int *p=0; *p=42; // UB in 2nd statement. int &r=*(int *)0; r=42; // UB in 1st statement. Either way, result (UB) is same.
1 reply 0 retweets 0 likes
Sorry for sloppy language; neither 1st is a "statement"; both are declarations.
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.