2 ms·
> Okay, sure, but I might be running a simulation or something, why should I be punished because some idiot decided to srand(time(0))? It's about cost/benefit.
by lmm 6y ago
> Okay, sure, but I might be running a simulation or something, why should I be punished because some idiot decided to srand(time(0))?
It's about cost/benefit. As far as the compiler/framework knows, there's a 20% (say) chance that you've just introduced a major security bug into your program. Doesn't the benefit of requiring some explicit acknowledgement of that case outweigh the cost? You contrast "I" with "some idiot", but the evidence of the last 20+ years is that most programmers who think they can write secure code can't; if you make those kind of warnings only to people who opt-in to them, the very people who most need them will not get them.