Live data from Hacker News

I stopped everything and started writing C again

kmx.io

31–40 of 475 posts

Re: I stopped everything and started writing C again

#31

Despite what some people religiously think about programming languages, imo C was so successful because it is practical. Yes it is unsafe and you can do absurd things. But it also doesn't get in the way of just doing what you want to do.

Sounds a bit like perl but at a lower level ?

Re: I stopped everything and started writing C again

#32
post #4

[flagged]

Rust is not free of trade offs and you're not helping the cause the way you think you are. Just a few off the top: - Rust is a much more complex language than C - Rust has a much, much slower compiler than pretty much any language out there - Rust takes most people far longer to "feel" productive - Rust applications are sometimes (often?) slower than comparable C applications - Rust applications are sometimes (often?…

> Rust is a much more complex language than C

Feature wise, yes. C forces you to keep a lot of irreducible complexity in your head.

> Rust has a much, much slower compiler than pretty much any language out there

True. But it doesn't matter much in my opinion. A decent PC should be able to grind any Rust project in few seconds.

> Rust applications are sometimes

Sometimes is a weasel word. C is sometimes slower than Java.

> Rust takes most people far longer to "feel" productive

C takes me more time to feel productive. I have to write code, then unit test, then property tests, then run valgrind, check ubsan is on. Make more tests. Do property testing, then fuzz testing.

Or I can write same stuff in Rust and run tests. Run miri and bigger test suite if I'm using unsafe. Maybe fuzz test.

Re: I stopped everything and started writing C again

#33
post #4

[flagged]

Rust is not free of trade offs and you're not helping the cause the way you think you are. Just a few off the top: - Rust is a much more complex language than C - Rust has a much, much slower compiler than pretty much any language out there - Rust takes most people far longer to "feel" productive - Rust applications are sometimes (often?) slower than comparable C applications - Rust applications are sometimes (often?…

> helping the cause

Rust evangelism is probably the worst part of Rust. Shallow comments stating Rust’s superiority read to me like somebody who wants to tell me about Jesus.

Re: I stopped everything and started writing C again

#34
post #5
post #4

[flagged]

Except complexity of language

IMO these are the major downsides of Rust in descending order of importance:

- Project leadership being at the whims of the moderators

- Language complexity

- Openly embracing 3rd party libraries and ecosystems for pretty much anything

- Having to rely on esoteric design choices to wrestle the compiler into using specific optimizations

- The community embracing absurd design complexity like implementing features via extension traits in code sections separated from both where the feature is going to be used and where either the structs and traits are implemented

- A community of zealots

I think the upsides easily outcompete the downsides, but I'd really wish it'd resolve some of these issues...

Re: I stopped everything and started writing C again

#35
post #11

I fully understand that sentiment. For several years now, I have also felt the strong urge to develop something in pure C. My main language is C++, but I have noticed over and over again that I really enjoy using the old C libraries - the interfaces are just so simple and basic, there is no fluff. When I develop methods in pure C, I always enjoy that I can concentrate 100% on algorithmic aspects instead of architectu…

About 16 years ago I started working with a tech company that used "C++ as C", meaning they used a C++ compiler but wrote pretty much everything in C, with the exception of using classes, but more like Python data classes, with no polymorphism or inheritance, only composition. Their classes were not to hide, but to encapsulate. Over time, some C++ features were allowed, like lambdas, but in general we wrote data classed C - and it screamed, it was so fast. We did all our own memory management, yes, using C style mallocs, and the knowledge of what all the memory was doing significantly aided our optimizations, as we targeted to be running with on cache data and code as much as possible. The results were market leading, and the company's facial recognition continually lands in the top 5 algorithms at the annual NIST FR Vendor test.

Re: I stopped everything and started writing C again

#36
post #8

I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one…

Don't forget Pascal is still alive.

Re: I stopped everything and started writing C again

#37

Despite what some people religiously think about programming languages, imo C was so successful because it is practical. Yes it is unsafe and you can do absurd things. But it also doesn't get in the way of just doing what you want to do.

Sounds a bit like perl but at a lower level ?

Sounds a bit like JavaScript, but at a tower level?

Re: I stopped everything and started writing C again

#38
post #18
post #4

[flagged]

That really depends what you want to do. All that security in Rust is only needed if there is a danger of hacks compromising the system. The moment you start building something that's not exposed to the internet and hacking it has no implications, C beats it due to simplicity and speed of development .

Correctness is not just about security. And the threat environment to which a program may eventually be exposed is not always obvious up front.

Also, no: that's only true for some kinds of programs. Rust, c++, and go all have a much easier ecosystem for things like data structures and more complex libraries that make writing many programs much easier than in C.

The only place I find C still useful over one of the other three is embedded, mostly because of the ecosystem, and rust is catching up there also.

(This is somewhat ironic, because I teach a class in C. It remains a useful language when you want someone to quickly see the relationship between the line of code they wrote and the resulting assembly, but it's also fraught - undefined behavior lurks in many places and adds a lot of pain. I will one day switch the class to rust, but I inherited the C version and it takes a while.)

Re: I stopped everything and started writing C again

#39

Despite what some people religiously think about programming languages, imo C was so successful because it is practical. Yes it is unsafe and you can do absurd things. But it also doesn't get in the way of just doing what you want to do.

Sounds a bit like perl but at a lower level ?

I wouldn’t compare them, C is very simple.

Re: I stopped everything and started writing C again

#40
post #38
post #18

Earlier quoted context omitted.

That really depends what you want to do. All that security in Rust is only needed if there is a danger of hacks compromising the system. The moment you start building something that's not exposed to the internet and hacking it has no implications, C beats it due to simplicity and speed of development .

Correctness is not just about security. And the threat environment to which a program may eventually be exposed is not always obvious up front. Also, no: that's only true for some kinds of programs. Rust, c++, and go all have a much easier ecosystem for things like data structures and more complex libraries that make writing many programs much easier than in C. The only place I find C still useful over one of the oth…

> much easier ecosystem for things like data structures and more complex libraries that make writing many programs much easier than in C.

So many people have implemented those data structures though, and they are available freely and openly, you can choose to your liking, i.e. ohash, or uthash, or khash, etc. and that is only for a hash table.

Those complex libraries are out there, too, for C, obviously.

The reason for why it is not in the standard library is obvious enough: there are many ways to implement those data structures, and there is no one size that fits all.

Post reply on HN