My most unpopular opinion: Modern C++17 is significantly less safe than C.
You "can", but it's just via UB. The *only* difference is where the UB formally got invoked tho:
-
-
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.
-
Sorry for sloppy language; neither 1st is a "statement"; both are declarations.
End of conversation
New conversation -
-
-
Indeed, I should have been more specific, I was thinking it was ill-formed rather then UB.
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.