Live data from Hacker News

Building a simple shell in C – Part 3

blog.ehoneahobed.com

1–10 of 48 posts

Re: Building a simple shell in C – Part 3

#3

Quoted post unavailable.

Why is that? C is still widespread in embedded and often the only choice. A lot of programs are written in C and need to be maintained. C is a simple language and powerful when used correctly. Of course we want people to keep using it.

Re: Building a simple shell in C – Part 3

#4

Quoted post unavailable.

Yes.

Some people (myself included) enjoy "unsafe" languages like C. I'm not one of those people that argue that being careful is enough. For applications where security really matters, _please_ use something with a bit more verification (though even that doesn't disqualify C, see seL4).

Now take a singleplayer game, or a text editor. It's not a security risk if these crash, so do you need the safety? I'd argue it's unnecessary, I can't remember a time where I saw a program like this print 'segmentation fault'.

I encourage anyone to write new software in "unsafe" languages, so long as it's not a security risk.

Re: Building a simple shell in C – Part 3

#5
post #3

Quoted post unavailable.

Why is that? C is still widespread in embedded and often the only choice. A lot of programs are written in C and need to be maintained. C is a simple language and powerful when used correctly. Of course we want people to keep using it.

It's not possible for humans to write correct and secure C code on an ongoing and consistent basis. Even when people pay careful attention, problems arise: consider the various 0days in sudo. C isn't simple: it's simplistic: its apparent simplicity comes from shifting the burden of safety from compilers to humans. Consequently, we spend trillions of dollars on dealing with the consequences of security vulnerabilities, most of which wouldn't exist if programmers used memory-safe languages. C++ and Rust (especially the latter) have superior safety profiles with little-to-zero runtime cost. While I acknowledge the need to maintain existing C programs, I believe that writing a new program in plain C is reckless and irresponsible.

Re: Building a simple shell in C – Part 3

#6

Quoted post unavailable.

While I’m certainly not a good C programmer by any means (I have been exploring Rust more recently as an alternative my use-cases), I find this piece very interesting

“Some People Were Meant for C”

https://www.cs.kent.ac.uk/people/staff/srk21//research/paper...

Re: Building a simple shell in C – Part 3

#8

Quoted post unavailable.

Yes. Some people (myself included) enjoy "unsafe" languages like C. I'm not one of those people that argue that being careful is enough. For applications where security really matters, _please_ use something with a bit more verification (though even that doesn't disqualify C, see seL4). Now take a singleplayer game, or a text editor. It's not a security risk if these crash, so do you need the safety? I'd argue it's u…

> Now take a singleplayer game, or a text editor. It's not a security risk if these crash, so do you need the safety

Any program that operates on untrusted data can be a security vulnerability. If an attacker can make your text editor execute arbitrary code if you open a specially crafted file, that's a major security problem. Why would you create the risk of this sort of problem on purpose when we have adequate safe languages these days?

Instead of making people decide on a case-by-case basis when "security really matters", let's make all programs safe. I mean, isn't your suggestion that text editors have not security implications evidence in itself that people will get it wrong when asked, "Does my program need security?".

Re: Building a simple shell in C – Part 3

#9

Quoted post unavailable.

While I’m certainly not a good C programmer by any means (I have been exploring Rust more recently as an alternative my use-cases), I find this piece very interesting “Some People Were Meant for C” https://www.cs.kent.ac.uk/people/staff/srk21//research/paper...

> The C language leads a double life: as an application programming language of yesteryear, perpetuated by circumstance, and as a systems programming language which remains a weapon of choice decades after its creation. This essay is a C programmer’s reaction to the call to abandon ship. It questions several properties commonly held to define the experience of using C; these include unsafety, undefined behaviour, and the motivation of performance. It argues all these are in fact inessential; rather, it traces C’s ultimate strength to a communicative design which does not fit easily within the usual conception of “a programming language”, but can be seen as a counterpoint to so-called “managed languages”. This communicativity is what facilitates the essential aspect of system-building: creating parts which interact with other, remote parts—being “alongside” not “within”.

This reads like an article in Social Text.

> Meditating on this communicativity suddenly gave way to a realisation: C is designed for communicating with aliens!

The memes make themselves.

Post reply on HN