Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why I love Coding in C

Name: Anonymous 2019-12-26 19:45

For the first time in almost a year, I brushed up on my C fundamentals and built a few toy programs. As I played around with pointers and printed out a memory location, I experienced a literal chill down my spine. I had almost forgotten how marvelous programming in this language was.

The last time I had coded anything substantive in C was almost two years ago, when I had written a Web Server for Professor Jae’s (in)famous system programming class. As a callow junior, I was baptised into a highly partisan cult of C and Unix worship, and I loved every second of it. Well, any second that didn’t involve string manipulation.

In the years since, I coded less and less in C and more and more in languages like Javascript and Python. I had become estranged from low-level systems stuff. Returning to C reminded me why so many programmers love this language.

C is closest to the real

Computer Science traffics in abstractions. As a dicipline, many of its most import conceits were theorized and proven before the existence of physical computers. Modern CS and Software Engineering retains this theoretic and abstracted quality, especially as one employs higher level languages and technologies. Almost by necessity, most programmers have a superficial conception of the vast, layered ediface of systems that enable and support their work. There isn’t anything wrong with this; abstraction is pleasurable and useful in and of itself. But there is also a pleasure to be had in being close to the metal.

When I saw a memory address outputted to stdout, I felt that I was as close to the hardware that I could be without literally opening up my machine and stroking my ram modules like a crazy person. Now I did this in a Ubuntu WSL instance, so who knows what interfaces actually mediated my encounter with a memory address. The point is that aside from assembly, C gets as close as possible to the physical, tangible and real aspects of computing. There is something intoxicating in this proximity to physical components. Your virtual objects, of dubious ontology, suddenly seem as real as your motherboard.

I hope that it is clear that what I am describing is fundamentally a feeling, and is as such highly subjective and is also not morally superior to any other preference. There are a lot of holes in this notion of C being “close to reality.” But it feels that way, and in articulating this, I hope I am able to explain some of the psychological appeal of lower level programming in C.

C as the Ur-language

There is another thing I love about programming in C. Because C endows a programmer with a profound degree of control over memory, you know that it is a very good choice (from the perspective of performance) for building other elemental software. C is often the language of choice for OS, language and systems development. You know you could, at least in theory, write almost everything that could be written in C - from the kernel at the bottom of your OS to the graphics library at the top. There is an immense sense of possibility here. It doesn’t actually matter if you never write a kernel module or a compiler; just knowing you could is often enough to entice you into the cult of C.

Name: Anonymous 2019-12-28 23:46

they’re not random but correlate 1:1 with programmer errors.
C has undefined behavior. The set of programs a C compiler can produce is larger than the set of valid programs. Same with sepples and other C-inspired trash.

Also, programmer errors aren't random? You choose to use something that can completely blow up if you aren't 100% careful to a superhuman degree. It's pure delusion. Do you think admitting to making mistakes makes you a brainlet pussy? This is useless nerd dick measurement that has nothing to do with building software.

It's okay to be white not a human formal verifier of imperative spaghetti code.

required by important space missions

And it shows.

A shortage of memory on board the Spirit Mars rover is what caused it to become unresponsive on the Martian surface on Jan. 22
"We just ran out of memory, ran out of RAM," Deliman said. "This is why we initially lost contact" with the rover. The six-wheeled vehicle runs hundreds of tasks simultaneously in normal operations, with each operation using its own chunk of RAM, he said.

Wow it's almost like there's a mature well-designed algorithm to automate freeing unused memory before OOM panics.


It's wasn't designed to be fast or close to hardware either. If C were designed for performance, it would have (as a portable standard):

- statements to ensure memory goes into L1, L2, L3 cache (apparently the biggest thing for performance nowadays)
- alignment specifiers
- SSE
- explicit vectorization (OpenMP)
- GPU-specific statements and primitives (OpenCL, CUDA)

But it doesn't have any of this, because it was only designed to be a DSL for a terrible family of operating systems from 40 years ago. Compiler vendors just made it fast because absolutely everyone was using it. (They still never made it as fast as FORTRAN because C is so bad.) Today JavaScript on V8 is almost as fast as C for the same reason. Your counterpart 20 yrs from now will be arguing that JavaScript is the best bare metal language just because there exists a compiler that makes it so through esoteric optimizations.

C is fucking AIDS from the same Intel school of thought that performance is all that matters. Fuck security, fuck resource isolation, fuck input validation, fuck race conditions, fuck side channels, I just want my gay casual game to load slightly faster. AIDS.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List