Hacker News new | ask | show | jobs
by indymike 1611 days ago
> Personally, I'm tired of people bitching about C.

The complaining gets old, but then again, memory leaks, overrruns and underruns and other C footguns get old, too. C has been and still is a great tool, but there is some level of... maybe we can do better 40 years later? You appreciate C more if you've had to implement anything reasonably large in assembly (which clearly you have).

> In fact, it wasn't even an option for most of the 1970's.

I started programming professionally in the mid 80s. There really wasn't much better than C. Pascal, compiled BASIC (it wasn't quite the VisualBASIC era yet)and ancient stuff like COBOL, PL/1 and FORTRAN were really the other real options. The old languages had a lot of limitations baked in. Pascal was better, but there were huge limitations imposed by Pascal arrays and Pascal's type system that rendered it very difficult to use for many entire classes of applications (anything where dynamic allocation of blocks of memory was needed, so for something like I/O... or video... or text editing (255 character lines much?) or whatever I happened to be working on. It wasn't impossible to do big projects with Pascal, but it was a lot more work.

2 comments

>The complaining gets old, but then again, memory leaks, overrruns and underruns and other C footguns get old, too.

Agreed. C is an old language, but at the time it was a very good language. One can argue the choice nowadays, but comparing it to PL/1?

A quick search on Linkedin:

* 117 Jobs for PL/1 programmers * 300,000+ jobs for C programmers

I'm not promoting the PL/I language, although I did do significant work with it back in the day, including the Prime operating system which had huge chunks written in a system-programming version of PL/I. PL/I likely never "made it" because it's a huge, bloated language that's hard to implement, compilers were scant, and they were expensive. For the curious, here are Prime's 2 system-programming subsets, the first, PL/P, is from 1978:

PLP: https://sysovl.info/pages/blobs/prime/pet/pe-t-483%20PLP%201... SPL: https://sysovl.info/pages/blobs/prime/pet/pe-t-xxx%20SPL%20R...

I am promoting the concept of strings having a built-in capacity and current length, and the language compiler and runtime understanding that rather than trying to use a byte array as a string. Even compiled BASIC I used in the late 70's had real strings like that.

> but comparing it to PL/1?

I think the point was that a language designed when pterodactyls ruled the skies had a better string implementation than C. Regardless, C's not going anywhere. You still need something close to the hardware that has better ergonomics than assembly language to implement that new safe language that mythical safe OS will be written in :-)

> maybe we can do better 40 years later?

But we do. There are plenty of programming languages besides C.

Also, while we're at it, UNIX is now a good 50 years old and if anything it contributes as much to the problem of unsafe software as anything else out there, every driver has the potential to hose the entire system.

> Also, while we're at it, UNIX is now a good 50 years old and if anything it contributes as much to the problem of unsafe software as anything else out there, every driver has the potential to hose the entire system.

If Unix was a single OS and codebase this holds water, but Linux isn't Unix, and real Unix comes in lots of flavors, and each has it's own set of issues. In any OS, save some microkernels, interfacing to hardware creates problems. Incidentally, insecure hardware is a universal problem.