777

No offence

you are viewing a single comment's thread
view the rest of the comments
[-] Ret2libsanity@infosec.pub 86 points 11 months ago

C is the sniper you don’t see

[-] Maultasche@feddit.de 16 points 11 months ago

And just like in Metal Gear, he dies of old age if you wait a bit.

[-] unicorn@mander.xyz 31 points 11 months ago

C is old, ubiquitous and still does not have a good replacement for its low-level cross-platform usecases, so I'll believe it when I see it 😄

[-] ursakhiin@beehaw.org 9 points 11 months ago

Rust is doing a very decent job of low-level cross platform. C just has a very long history.

[-] unicorn@mander.xyz 5 points 11 months ago

Its cross-platform support (not just for using but also for building it) is not there yet, and it is quite huge and unstandardized with only one full implementation. I'd agree the last part will change with age, but given the frequent large changes and feature additions I am afraid it will be harder and harder and it is simply too complex and fast-moving for many low-level applications. It is closer to C++ than C in my eyes. I'd be happy seeing it replace C++ though for its memory safety benefits!

[-] jlh@lemmy.jlh.name 2 points 11 months ago

At the same time, C is the only stable ABI available for Rust.

[-] pingveno@lemmy.ml 2 points 11 months ago

That's true, but they're working on an ABI implementation. It's no mean feat with a language like Rust. A quick search around the Internet found various possible candidates, though many of the discussion threads have petered out.

[-] Ret2libsanity@infosec.pub 1 points 11 months ago

Rust won’t replace c.

The programs are too bloated for many embedded systems where every byte counts because it’s in ROM or loaded jnto IRAM

All that memory safety and garbage collection, for example, comes at a big cost

[-] Faresh@lemmy.ml 1 points 11 months ago

garbage collection

I don't think Rust has a garbage collector.

[-] anewbeginning@lemmy.world 2 points 11 months ago
[-] unicorn@mander.xyz 2 points 11 months ago

I wouldn't say "need", but there are possible improvements to ergonomics and safety that wouldn't make the language itself more complex or high level. I think it does its job quite well though and will be here for decades to come.

[-] Hazzia@discuss.tchncs.de 1 points 11 months ago

I'm not too familiar with C, but I was under the impression that C++ was deceloped as a superset to C, and was capable of everything C could do. Is that not the case?

[-] abessman@lemmy.world 6 points 11 months ago

I mean yeah, if you restrict yourself to the C part of C++ it can do everything C can. But then you're not getting any of the advantages of C++.

Once you start using things like classes and templates heavily, your program will quickly outgrow low-end hardware.

[-] pedro@lemm.ee 2 points 11 months ago

"Outgrow low-end hardware"?

What does a programming language have to do with this?

[-] abessman@lemmy.world 7 points 11 months ago

Everything.

Every programming language is an abstraction layer between the programmer and the machine that will run the code. But abstraction isn't free. Generally speaking, the higher the abstraction, the less efficient the program.

C++ optionally provides a much higher level of abstraction than pure C, which makes C++ much nicer to work with. But the trade off is that the program will struggle to run in resource constrained environments, where a program written in C would run just fine.

And to be clear, when I say "low-end hardware", I'm not talking about the atom-based netbook from 2008 you picked up for $15 at a yard sale. It will run C++ based programs just fine. I'm talking about 8- or 16-bit microcontrollers running at <100 MHz with a couple of hundred kB of RAM. Such machines are still common in many embedded applications, and they do not handle C++ applications gracefully.

[-] nothacking@discuss.tchncs.de 1 points 11 months ago

Compile times get insanely huge.

[-] Ret2libsanity@infosec.pub 3 points 11 months ago

Compile a c program with gcc then with g++.

You will quickly see the difference in size

[-] nothacking@discuss.tchncs.de 2 points 11 months ago

And speed too. A small program using only C features can compile 5x faster with a c compiler then a c++ one. (GCC will use c++ mode on a .cop file so make sure it is .c)

[-] Rodeo@lemmy.ca 1 points 11 months ago

Ada has been around since 1983 and is objectively superior. Yes I will die on that hill.

It's too bad programmers are all such egotards they think they can write bugfree programs in C, while whining about how "restrictive" a safe language like Ada is.

[-] hglman@lemmy.ml 10 points 11 months ago

C is back at HQ with 2 Stars and enough political capital to serve till they die.

this post was submitted on 16 Jul 2023
777 points (99.7% liked)

Programmer Humor

31251 readers
848 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS