←back to thread

288 points Twirrim | 1 comments | | HN request time: 0.206s | source
Show context
harry8 ◴[] No.41874909[source]
Is C++ capable of deprecating or simplifying anything?

Honest question, haven't followed closely. rand() is broken,I;m told unfixable and last I heard still wasn't deprecated.

Is this proposal a test? "Can we even drop support for a solution to a problem literally nobody has?"

replies(12): >>41875009 #>>41875032 #>>41875407 #>>41875528 #>>41875757 #>>41875887 #>>41876970 #>>41877466 #>>41877729 #>>41877980 #>>41878258 #>>41878901 #
mort96 ◴[] No.41876970[source]
How is rand() broken? It seems to produce random-ish values, which is what it's for. It obviously doesn't produce cryptographically secure random values, but that's expected (and reflects other languages' equivalent functions). For a decently random integer that's quick to compute, rand() works just fine.
replies(2): >>41878937 #>>41880390 #
1. akdev1l ◴[] No.41878937[source]
> The function rand() is not reentrant or thread-safe, since it uses hidden state that is modified on each call.

It cannot be called safely from a multi-threaded application for one