3 ms·
Mainframes had bounds checks. It didn't cost much, but C omitted them. Some of the undefined behavior in C particularly around accesses and overflow could be ch
by wbl 9y ago
Mainframes had bounds checks. It didn't cost much, but C omitted them. Some of the undefined behavior in C particularly around accesses and overflow could be changed to implementation defined to fix some of the more footgunny parts. Until C 99 C could not vectorize nearly as much as Fortran. C won because of Unix network effects and the PDP, not because it was that good a choice.
- ajross 9y agoSurely someone had checked loads. The IBM 360/370 did not (unless it was some optional thing they sold -- certainly it wasn't part of the basic architecture), so "mainframes" seems rather spun. Likewise, yes, C's floating point calling conventions sucked and Fortran continued to see use in numerics work for a long time. But at the same time no one was writing performance-sensitive vector code for their Cray's in high level languages, ever. And frankly no one even thought to until GPUs made low level code impossible. I'll say it again, C won because: 1. Compilers could be (and were!) written for any byte-addressible architecture by one hacker in a basement... 2. ...that produced output code quality comparable to what you could get anywhere else in the industry 3. ...and take advantage of the huge community of C hackers. Different languages running on supercomputers and non-360 mainframes wouldn't have changed any of that.
- wbl 9y ago1 and 2 also seem true for Pascal. Network effects are important but they would have worked for any language. Tony Hoare discussed bounds checking on the Burroughs mainframe.