Hacker News new | past | comments | ask | show | jobs | submit login

I cannot help but wonder why starting a new project in C in 2025. It’s like driving a car with no seat belts. You sure you want to do that?



I moved from C++ to C and I am more productive. I also think this "no seat belts" meme is exaggerated, as there are plenty of tools and strategies to make C fairly safe to use. (it is true though that many people do not put the seat belts on).


In my experience, although many of the other programming languages do improve some things compared with C, they also make many things worse and avoid some of the benefits of C programming.


I can't recall anything in that sense regarding Modula-2 and Object Pascal, other than not bringing UNIX to the party.


I cannot help but wonder why I would learn a whole new language before even beginning to start a new project when I already know C. Though, generally speaking, I tend to use C++ for new projects -- usually depending on what libraries I'm using, if the lib is in C I use C and if the lib is in C++ I use C++. The current thing I'm working on is intended as a Python extension module and Python is written in C so...

And, yes, I know it's trivial to interface the Python C-API with C++ and quite often better as the 'object model' is very similar but the underlying concept I wanted to explore (guaranteed tailcalls) isn't possible in C++ from what I can tell.


Yes, yes I'm sure. I like using C sometimes.


This is the best question for me. Writing these codes in C language is the best way to learn the file structure of jvm/dalvik/pe. This process makes me like C language more. For me, I think it is simple and pure, which is enough.


Or riding a motorcycle.

But stupid real-world analogies are stupid.


i only write in C. if id build a car it wouldnt have seatbelts. boring, put in ejector seats! not safe? no problem for C :).


ejector seats in C car?

goto eject; ...more code we are going to ignore, it could be important but nah, ignore it, what could be happen?...

eject: up_through_the_roof();

:D


We need people who can (and do) write in C, assembly, and all these low-level languages. Otherwise, software will just get slower and slower.


Rust has the same low-level memory model as C without the footguns.


Rust certainly does have some improvements, but I'm not 100% certain that it's the best tool for all low-level software. For example, I'm experimenting with Rust for some filesystem type code and I can't figure out how to write/read a struct to/from disk all at once. I'm brand new to Rust, so it's quite possible that it can be done and I just don't know the technique. Basically, I'm looking for something in Rust analogous to C's fread/fwrite. I know I can write out each field of the struct individually, but when the struct has many fields it means having to write a huge amount of nasty boilerplate code when in C it's a single function call (fread/fwrite).


This is generally unsafe, so to make it safe there needs to be something that restricts what kind of things you can read and write.

For example, if your structure contains a reference, and you read an instance of that from disk, then you now have a potentially invalid reference, bypassing Rust's guarantees. Reading a structure of i32 numbers is safe, but it also has endianness footguns.

The zerocopy crate implements traits and gives you a derive macro to mark types as being safe to serialize/deserialize in a safe way.


I think you're going to want to reach for serde. Its a bit of annotating but you can then de/serialize structs to arbitrary formats with one call.


Thanks for the suggestion! I'll have a look.


I love Rust but we really got to stop the link between C and Rust.

If someone mentions C, that's not a free invite to start educating them on why they SHOULD use Rust. No one at the party is going to talk to you again that night


When debugging complex projects, the C language is more flexible and convenient to view data in memory.


It's thanks to people like you that rust is not more widely used, you actively make people avoid the rust cummunity because they will think everybody i like you!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: