Can you please provide an example for something that is common practice, and isn't actively discouraged?
-
-
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 -
Replying to @pcwalton @shafikyaghmour and
The false sense of security causes people to not code defensively the way they would in modern C.
1 reply 1 retweet 2 likes -
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
Depends on whose safety you're worried about. C++ is good for your job safety, bad for other people's (users') safety.
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.