4 ms·
What about datetime, random, system, etc?
by innocenat 5y ago
What about datetime, random, system, etc?
- matheusmoreira 5y agoThey're all system calls that are better served by using operating functions directly. I'm not sure how the compiler could possibly optimize those away though. Maybe the random function could become a very untrustworthy instruction?
- _kst_ 5y agoRandom number generation generally isn't handled by system calls. It's just computation. (Some languages do provide support for hardware [pseudo-]random number generation. C doesn't.) More generally, using system calls directly for things like getting the current time makes sense only if you don't care about portability. C can support both portable and non-portable code. Both are important. I get the impression that C is too high-level, and assembly language is too tedious, to fully support your requirements. I sympathize with your situation, but it's not one that most programmers share.
- matheusmoreira 5y ago> I get the impression that C is too high-level, and assembly language is too tedious, to fully support your requirements. Definitely seems that way to me as well. Still, if I bend C enough it turns into something that's almost what I want. I just wish GCC had a couple more flags to control code generation in these surprising cases.