this post was submitted on 14 Jun 2024
673 points (93.0% liked)

Programmer Humor

19589 readers
654 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

Stop comparing programming languages

  • Python is versatile
  • JavaScript is powerful
  • Ruby is elegant
  • C is essential
  • C++
  • Java is robust
you are viewing a single comment's thread
view the rest of the comments
[–] OpenStars@discuss.online 10 points 5 months ago (7 children)

What is C essential for anymore these days? Genuine question btw.

I thought C++ was essential for microprocessor control, but that it depends and sometimes I gather people use C instead, but not always.

Use the language that the company hires you to know:-).

[–] Norodix@lemmy.world 28 points 5 months ago (2 children)

I do embedded. Its all C. You can't replace it.

[–] Shareni@programming.dev 8 points 5 months ago (2 children)
[–] tehbilly@lemmy.dbzer0.com 7 points 5 months ago (1 children)

Wait, that's like C with ~~extra~~ fewer steps

[–] Shareni@programming.dev 6 points 5 months ago

And I think they rewrote a bunch of C libraries in order to have a better cross-platform compiler for C and zig. Or something along those lines

[–] xigoi@lemmy.sdf.org 2 points 5 months ago
[–] Agrivar@lemmy.world 7 points 5 months ago

Inertia is a mofo. I did embedded programming for industrial automation almost thirty years ago, building upon and expanding an existing nightmare of C code... and I bet there's still some of mine running something out there to this day.

[–] Brosplosion@lemm.ee 26 points 5 months ago

Most of the Linux kernel is written in C

[–] whotookkarl@lemmy.world 16 points 5 months ago (1 children)

Pretty much all of the command line coreutils programs I use daily are in C; cd, ls, pwd, touch, rm, etc. If I want to write some small utility I'll usually reach for a scripting language first like bash python ruby etc, but if it needs to be small and fast I'll use C instead.

[–] BatmanAoD@programming.dev 2 points 5 months ago (1 children)

Genuine question: if you're writing a new CLI utility, why not Rust? This is arguably where Rust has most excelled, most famously with ripgrep.

[–] whotookkarl@lemmy.world 4 points 5 months ago

I don't have anything against Rust, I'm just not very familiar with it

[–] 257m@sh.itjust.works 14 points 5 months ago

any sort of FFI on a modern OS will need to be done through C

[–] MiltownClowns@lemmy.world 12 points 5 months ago (1 children)

Used to be embedded systems mostly. Microwaves and the like. Although with the advance of the smart home I don't know I'd that's still true.

[–] odium@programming.dev 3 points 5 months ago

The majority of microwaves, fridges, etc. Still don't connect to WiFi. It's mostly the high end ones which do.

[–] psycho_driver@lemmy.world 7 points 5 months ago (1 children)

The thing with C is that it's almost always going to be the fastest high-ish level language and it has an extremely stable ABI. Self contained code written 30 years ago will likely compile with only minor (and sometimes no) tweaks today. You're lucky to go 3 years on C++ without something fairly big breaking due to changes in the underlying language and ABI.

[–] OpenStars@discuss.online 1 points 5 months ago

That's the kind of insight I was hoping for, thanks for sharing!

C is also just a fun language to code in. You know, aside from pointers ofc:-). Though I have never done more than dabble around personally.

[–] BatmanAoD@programming.dev 3 points 5 months ago* (last edited 5 months ago) (1 children)

This is a really good post about why C is so difficult to seriously consider replacing, or even to avoid by using a different language for certain projects: https://faultlore.com/blah/c-isnt-a-language/

[–] OpenStars@discuss.online 1 points 5 months ago (1 children)

It isn't just a language, but it is a language - as it eventually gets around to saying, but it starts off by saying that it isn't, then later corrects itself to say that it is, etc. I feel like the focus of this ignores the historical context of what C was written to be for - at the time there was like Assembly, BASIC, Fortran (?), other long-dead languages like was it A and/or A* or whatever, there was a B language too! (developed by Bell Labs, if Google can be trusted these days), etc. - and C was developed to be better than those. So saying that like it lacks type conversions is very much missing the point - those were not invented yet. A lawn mower also lacks those, but it's okay bc it doesn't need them:-) I am probably nit-picking far too many points, I suppose to illustrate that the style of the article became a hindrance to me to read it b/c of those reasons. But thank you for sharing regardless.

[–] BatmanAoD@programming.dev 2 points 5 months ago (1 children)

I don't really like the title either, but the article does demonstrate how unfortunate it is that we're effectively locked in to using the ABI at some level of nearly every piece of software.

That said, there definitely were languages with better type systems prior to the invention of C. Pascal is a frequently-cited example.

[–] OpenStars@discuss.online 1 points 5 months ago

Oh wow, good points!:-)