Live data from Hacker News

I stopped everything and started writing C again

kmx.io

311–320 of 475 posts

Re: I stopped everything and started writing C again

#312
post #241
post #221

Earlier quoted context omitted.

This is objectively nonsense

Interesting use of the word 'objectively' there.

How can it not be true? One of the primary features of the rust compiler is enforcing memory safety at compile-time. C doesn't have anything like that. There are an entire class of bugs that are impossible to implement in rust.

Re: I stopped everything and started writing C again

#313

Earlier quoted context omitted.

He's not making a comment about everyone , it's a specific comment about how often long time C programmers make basic mistakes after a million SLOC or so. In this instance Walter is correct - the mistakes he listed are very rarely made by experienced C programmers, just as ballet dancers rarely trip over their own feet walking down a pavement. The problem of those errors being commonplace in those that are barely fiv…

> just as ballet dancers rarely trip over their own feet walking down a pavement What about about walking down a busy construction site? The most charitable and correct interpretation I can think of is "I'm a professional. Seatbelts and OSHA destroy my productivity."

> What about about walking down a busy construction site?

Coordinated people with some years of experience pay attention to the ground and overhead cranes and conveyor belts and survive walking through construction sites, mine sites, aviation hangers, cattle yards, musters, et al on a routine basis. I'm 60+ and have somehow navigated all those environs - including C for critical system control.

These are dangerous environments. No one denies this. It's still true that the longer you inhabit such spaces the safer your innate learned behaviour is.

C has seatbelts and OSHA - valgrind, et al tools abound for sanity checking.

Walter's GP statement is literally little more than "eventually you grow out of making the simple basic maistakes" - eventually, after some years of practice - which is a real problem with C, it takes time to not make the basic mistakes. After all that, there's always room, in C, in Rust, whatever, to make non basic non obvious mistakes.

Re: I stopped everything and started writing C again

#314
post #275
post #151

Earlier quoted context omitted.

If you're using VS Code then you can add `"rust-analyzer.check.command": "clippy"` to your `settings.json`. I assume there's a similar setting for rust-analyzer in other editors.

You might want to reconsider use of rust-analyzer, it isn't safe to use on code you haven't written yourself. https://rust-analyzer.github.io/book/security.html

> it isn't safe to use on code you haven't written yourself

Neither is cargo (nor npm, nor any other package manager, for that matter).

I'm not sure what value being that paranoid is buying you in the long run.

Re: I stopped everything and started writing C again

#315
post #249

So nobody would use code written in common lisp... but they will use code written in an entirely new language.... right...

I love Common Lisp, but I would definitely think twice before implementing anything I want other people to use on their machines in it. A tiny C executable is pretty nimble in comparison to anything you'll get out of Common Lisp.

I understand, it isn't that bad though: a web app of mine with dozens of dependencies and all templates and static assets is 35MB with SBCL and core compression (that includes the compiler and debugger, useful to connect to a running app and exploring its state (or even hot reloading code)). I suppose that's in the ballpark of a growing Go application. LispWorks has a tree shaker that builds a hello world in 5MB.

Re: I stopped everything and started writing C again

#316
post #55

Here's what kc3 code looks like (taken from [1]): def route = fn (request) { if (request.method == GET || request.method == HEAD) do locale = "en" slash = if Str.ends_with?(request.url, "/") do "" else "/" end path_html = "./pages#{request.url}#{slash}index.#{locale}.html" if File.exists?(path_html) do show_html(path_html, request.url) else path_md = "./pages#{request.url}#{slash}index.#{locale}.md" if File.exists?(p…

Maybe early return isn’t allowed in that language, but it sure would make that a heck of a lot easier to read.

Re: I stopped everything and started writing C again

#317

Earlier quoted context omitted.

You can certainly do entirely absurd things in Perl. But it is a lot easier / safer work with. You get / can get a wealth of information when you the wrong thing in Perl. With C segmentation fault is not always easy to pinpoint. However the tooling for C, with sone if the IDEs out there you can set breakpoints/ walk through the code in a debugger, spot more errors during compile time. There is a debugger included wit…

Eh Segfaults are like the easiest error to debug, they almost always tell you exactly where the problem is.

Except when they don’t. I’m debugging something right now that runs fine under debugging conditions and crashes with a segfault in real life. It’s not randomized memory (messed with that), it’s likely some race where the timing is changed by the debugger.

Re: I stopped everything and started writing C again

#318
Nothing make sense.

What is your killer app? What CL has to do with no one running it? What problem you had with garbage collectors? Why is C is the only option? Are you sure all those RCEs because of VMs and containers and not because it all written in C? "There are no security implications of running KC3 code" - are you sure?

Re: I stopped everything and started writing C again

#319
post #69
post #58

Earlier quoted context omitted.

> 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. So … make && make check ?

"How to install and use "make" in Windows?" https://stackoverflow.com/questions/32127524/how-to-install-...

If you can figure out installing a C compiler, surely you can figure out installing make?

Re: I stopped everything and started writing C again

#320
post #185

Earlier quoted context omitted.

The single best feature (and I would say the _core_ feature separating it from C) that C++ has to offer is RAII and zig does not have that. So I don’t know which good parts of C++ they kept. Zig is more of its own thing, and they take from wherever they like, not just C++.

Zig has defer, which is arguably way simpler. Is there something RAII can do that defer can't? Not everyone likes RAII by itself. Allocating and deallocating things one at a time is not always efficient. That is not the only way to use RAII but it's the most prevalent way.

Defer can be omitted
Post reply on HN