Live data from Hacker News

I stopped everything and started writing C again

kmx.io

421–430 of 475 posts

Re: I stopped everything and started writing C again

#421

Earlier quoted context omitted.

Heap was invented for a reason, and some tasks are naturally easier to model with it. The problem is that once it's there, people start using it as the proverbial hammer, and everything looks like a nail even if it isn't. Note though that ""allocate all of memory into a buffer at startup" is a lot more viable if you scope it not to the start of the app, but to the entrypoint of some code that needs to make a complica…

That works for something where the events being handled are like "serve a web page" or "compile a C function". It doesn't work for a spreadsheet or word processor or a web browser.

I'm not convinced it even works very well for either of those cases. It's common in many applications to return the result of a computation as an object in memory, like an array or string of arbitrary length or a treelike structure. Without the ability to allocate memory which exists after a function exits, I'm not sure how you'd do that (short of solutions which create arbitrary limits, like writing to a fixed-size buffer).

Re: I stopped everything and started writing C again

#423
post #241

Earlier quoted context omitted.

Interesting use of the word 'objectively' there.

>> One catches far more issues than another > akshually they have same amount of bugs You literally segfault by dereferencing invalid pointer.

I agree.

But: If you are LUCKY! The worse case is if you DON'T segfault by dereferencing invalid pointer.

Re: I stopped everything and started writing C again

#427

> Garbage collectors suck, and all my Common Lisp projects have very limited applications just because of the garbage collector. If only a very tiny fraction of the resources effort, research, time, money etc of all ML/AI funds are directed for the best design of high performance GC, it will make a software world a much better place. The fact that we have a very few books dedicated on GC design and thousands of books…

[dead]

Re: I stopped everything and started writing C again

#428

> who can write a strategy game with thousands of units each having their own vision of the world, without having a garbage collector running like hell Even in ecosystems where you don't have a way to opt-out of GC, there are strategies for dramatically minimizing the impact. Just because you have some aspects of the product rely on it should not be fatal unless we are being a bit hyperbolic about the purity of tech.…

[dead]

Re: I stopped everything and started writing C again

#429

Earlier quoted context omitted.

Rust is not a modern C++, their core models are pretty different. Both Rust and C++ can do things the other can’t do. C++ is a more focused on low-level hyper-optimized systems programming, Rust is a bit higher level and has stronger guardrails but with performance closer to a classic systems language. I do think Zig is a worthy successor to C and isn’t trying to be C++. I programmed in C for a long time and Zig has…

C++ is (according to Bjarne Stroustrup) a general purpose programming language that can be used to build general business software and applications with, not just a systems PL. This is why perf is all over the place —- the core language is fast like C but the stdlib contains terribly slow code (regex, exceptions) and ways to waste lots of cycles (wrapping everything in smart pointers, using std::map instead of unorde…

What's slow about regex? A properly optimised regex engine ought to be very efficient (if used sensibly, at least).

Re: I stopped everything and started writing C again

#430
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.

Eh, you can just distribute a .lisp file as though it were a ruby or perl script. CL is faster than the usual scripting languages, but admittedly not as fast as C or Rust.
Post reply on HN