News for hackers. Stuff that matters.
Re:Show HN: I wrote a Java decompiler in pure C language by kamma4434 on Tuesday June 03, 2025 @02:26PM (#44173067)
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?
Re:Show HN: I wrote a Java decompiler in pure C language by uecker on Tuesday June 03, 2025 @03:37PM (#44173790)
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).
Re:Show HN: I wrote a Java decompiler in pure C language by zzo38computer on Tuesday June 03, 2025 @02:28PM (#44173085)
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.
Re:Show HN: I wrote a Java decompiler in pure C language by pjmlp on Tuesday June 03, 2025 @02:56PM (#44173369)
I can't recall anything in that sense regarding Modula-2 and Object Pascal, other than not bringing UNIX to the party.
Re:Show HN: I wrote a Java decompiler in pure C language by ronsor on Tuesday June 03, 2025 @02:47PM (#44173277)
Yes, yes I'm sure. I like using C sometimes.
Re:Show HN: I wrote a Java decompiler in pure C language by sim7c00 on Tuesday June 03, 2025 @02:52PM (#44173312)
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 :).
Re:Show HN: I wrote a Java decompiler in pure C language by SunlitCat on Tuesday June 03, 2025 @03:06PM (#44173468)
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

Re:Show HN: I wrote a Java decompiler in pure C language by Sophira on Tuesday June 03, 2025 @04:32PM (#44174400)
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.
Re:Show HN: I wrote a Java decompiler in pure C language by AgentME on Tuesday June 03, 2025 @04:46PM (#44174536)
Rust has the same low-level memory model as C without the footguns.
Re:Show HN: I wrote a Java decompiler in pure C language by dardeaup on Tuesday June 03, 2025 @06:37PM (#44175526)
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).
Re:Show HN: I wrote a Java decompiler in pure C language by saintfire on Tuesday June 03, 2025 @08:37PM (#44176208)
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.
Re:Show HN: I wrote a Java decompiler in pure C language by dardeaup on Tuesday June 03, 2025 @09:09PM (#44176354)
Thanks for the suggestion! I'll have a look.
Re:Show HN: I wrote a Java decompiler in pure C language by whytevuhuni on Wednesday June 04, 2025 @12:52PM (#44182775)
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.

Re:Show HN: I wrote a Java decompiler in pure C language by ramon156 on Wednesday June 04, 2025 @04:08AM (#44178330)
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

Re:Show HN: I wrote a Java decompiler in pure C language by UncleEntity on Tuesday June 03, 2025 @08:13PM (#44176096)
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.

Re:Show HN: I wrote a Java decompiler in pure C language by userbinator on Wednesday June 04, 2025 @01:32AM (#44177518)
Or riding a motorcycle.

But stupid real-world analogies are stupid.

Re:Show HN: I wrote a Java decompiler in pure C language by hualaka on Wednesday June 04, 2025 @04:29AM (#44178471)
When debugging complex projects, the C language is more flexible and convenient to view data in memory.
Re:Show HN: I wrote a Java decompiler in pure C language by neocanable on Wednesday June 04, 2025 @10:18AM (#44180995)
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.
Re:Show HN: I wrote a Java decompiler in pure C language by lsferreira42 on Wednesday June 04, 2025 @10:54AM (#44181355)
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!