6 ms·
So the compiler actually can't optimize because of legacy errno cruft? That's hilarious...
by matheusmoreira 5y ago
So the compiler actually can't optimize because of legacy errno cruft? That's hilarious...
- varajelle 5y agoThe compiler respects the C standard by default. According to it, puts() is the same as a printf() in some conditions, but sqrt() is not the same as the instruction. If you don't like C, you can use a dialect of it by setting some flags: -fno-math-errno if you want to optimize sqrt anyway or -fno-builtin if you don't want the compiler to replace functions calls
- matheusmoreira 5y agoI like C for the most part. I don't like the standard library. It's got stuff like errno, a thread local global variable, and that's just the simplest problem. Freestanding C turned out to be a far better language just because it has no legacy cruft weighing it down. > -fno-math-errno That's interesting, didn't know about it.