r/programming • • May 01 '18

C Is Not a Low-level Language - ACM Queue

https://queue.acm.org/detail.cfm?id=3212479
152 Upvotes

303 comments sorted by

View all comments

Show parent comments

29

u/yiliu May 02 '18

Right, exactly. That's his point. People think other languages are high-level, but C is close to the metal. But the metal C was close to is long gone, and there's now many layers of abstraction between you and the hardware--and those layers are starting to leak.

He didn't claim other languages are lower-level, and this wasn't a hit-piece on C. It's just an interesting realization. I'm detecting a fair bit of wounded pride in this thread.

9

u/AlmennDulnefni May 02 '18

C is as close to the metal as it ever was. The metal just got a lot weirder. And maybe a bit crumbly.

9

u/cbbuntz May 02 '18

If you think about a basic for loop using pointers

for (int *p = start; p < end; p++)

You know pretty much know exactly how that would look on an older CPU with no vectorization and a more limited instruction set. But there's a lot more going on under the hood now, so you can make an educated guess as to what the generated code will be, but it's a lot more abstract now. You'd have to heavily rely on intrinsics to get predictable results now. C wasn't written for modern CPUs, so compilers have to automagically translate it to something that makes more sense for modern architectures. They usually do a good job, but Dennis Ritchie wouldn't make the same language if were to write it from the ground up today.