News for hackers. Stuff that matters.

Panzerschrek

Is it memory safe? Or is it yet another "better C"?
https://github.com/DeDf/winxp_source

Knowing that Github is owned by Microsoft, they probably are fine with it.

Recently I did something similar (or even more labor-intensive). I recreated an existing game from scratch by manually rewriting its code without even thinking about LLM/"AI" tools usage. (see my submissions).

But I agree, that using an "AI" tool may be a serious temptation and thus way less new porting projects will be done with such care.

Re:The importance of communities around software on Friday October 30, 2026 @01:23AM (#50300139)
> there is something more important than license: community

Is there such thing as "community" at all? As I know, the majority of open-source projects are developed by a single person, where others only contribute bug reports (in best case). It's not a community, if there is such imbalance in contribution and power.

Only a handful of projects (a small percentage) has actual community with many members doing meaningful contribution. But they are most notable ones, so that one may think, that all open-source projects function like this.

Re:Iterating Backwards in C on Friday October 30, 2026 @01:07AM (#50300053)
I do this in another way:

  for( size_t i_plus_one = count; i_plus_one > 0; --i_plus_one )
  {
      const size_t i= i_plus_one - 1;
      // actual loop code
  }
It's in my opinion better than using i-- as condition, since I generally avoid using results of -- and ++, because doing so is bug-prone.
Re:Billion-query-per-second lookup tables in C++ on Wednesday October 28, 2026 @04:13AM (#50270535)
> How do we find the association values? We sort the characters by how many keys they touch. We then take them one at a time and try 0, 1, 2, … until we find a value that does not cause a collision.

This sounds too easy to be true. As I understand, that's the core of the whole approach - to find a table filled with some magic values giving perfect hashing. And it shouldn't be that simple, since search space is huge (a table with 256-values each with 8 bits size at least).

Re:Billion-query-per-second lookup tables in C++ on Wednesday October 28, 2026 @12:50AM (#50269458)
Nice approach. I hope some time compilers will eventually learn to detect code containing a bunch of if-else with string comparison and replace it with perfect hashing.
Look at my language: https://github.com/Panzerschrek/U-00DC-Sprache/. It has plenty of interesting ideas, but is fully human-written (and will remain human-written).
> Memory is a handful of data stacks that the compiler assigns statically

I doubt this can work well in all cases. Sooner or later one needs proper heap.

Re:The Quake Fan who built the map editor everybody uses on Saturday October 24, 2026 @05:10AM (#50219457)
I don't know what Unreal Tournament did use internally, it's hard to investigate, since there is no (official) source code release for it. But I do know, that brush-based (additive) approach isn't strictly necessary for creating maps for Quake/Quake II/Quake III, it's technically possible to write a map compiler taking maps in some subtractive format. The reason why it's not done (or at least not common) is because it's not a trivial task and because existing infrastructure adds some friction.
Re:The Quake Fan who built the map editor everybody uses on Saturday October 24, 2026 @04:50AM (#50219362)
Trenchbroom is very good, but I still think, it's not the best possible map editor. It uses brush-based approach, which isn't the right way of designing maps for games in closed spaces (like Quake). Creating each room requires creating at least 6 brushes for its walls/floor/ceiling, which is way to much for such stuff. On the other hand Unreal Editor (for first Unreal and Unreal Tournament) supports creating rooms directly (as subtractive brushes), when two room primitive touch each other, they are automatically connected.
Re:We Have Traits at Home on Friday October 23, 2026 @04:42AM (#50206092)
I see little to no benefits of introducing such "traits" into a language having duck-typing in templates. It may sometimes improve code readability (slightly), but with more boilerplate code for traits handling in exchange. And the result machine code will be identical to code with no traits at all (with only duck-typing).

C++ is a good example of this. It had duck-typing in templates for decades. Then some sort of trait-like mechanism named concepts has been introduced. The only benefit of them seems to be slightly better error messages if someone misuses a template class/function.

Re:I can't believe PowerShell is good on Thursday October 22, 2026 @01:22AM (#50191503)
Does it have automatic error handling, so that if one command fails, the whole script fails too? Last time I tried it, I needed to write

   if ($LastExitCode -ne 0)
after each command.
Re:Composite objects and C++26 the std:polymorphic type on Wednesday October 21, 2026 @03:54AM (#50177405)
Typical C approach. In C++ this should be done with std::variant instead. It has the exact same binary layout, but is type-safe (compared to union usage).
Re:Composite objects and C++26 the std:polymorphic type on Wednesday October 21, 2026 @03:52AM (#50177393)
Does std::polymorphic require passed types to be copyable?
Re:JAXA is about to perform a Phobos sample return mission on Wednesday October 21, 2026 @01:00AM (#50176273)
Russia tried such mission back in year 2011: https://en.wikipedia.org/wiki/Fobos-Grunt. Sadly it failed shortly after the launch.
Re:Flatpak – An Insecurity Nightmare on Monday October 19, 2026 @08:52AM (#50151826)
My app doesn't require sandboxing. And vulnerabilities aren't important, since it's not intended to work with untrusted data and/or use network.
Re:Flatpak – An Insecurity Nightmare on Monday October 19, 2026 @06:13AM (#50150531)
I once tried packaging my application using Flatpack. But I saw no benefits of using it. I can as well just link all my dependencies statically (which I eventually ended using).
Re:Constructors Shouldn't Throw on Monday October 19, 2026 @02:01AM (#50148900)
> Turn your Database class into a state machine with an uninitialized and a connected state. Then have a Database.connect()

It's a bad advice. It's preferred instead to have a connect function returning a database instance in a successful case or an error otherwise.

Re:Parser Combinators on Monday October 19, 2026 @01:31AM (#50148714)
All this seems for me to be overcomplicated. Naturally parsing is just a function, which may call subfunctions, sometimes recursively. Sometimes it can do it in a loop - in order to parse sequences. I have written many parsers in such a way and I didn't even require such terms as "parser combinators".
Re:I Love Software Rendering on Friday October 16, 2026 @10:02AM (#50118518)
Software renderer of Quake II has no colored lighting. It's OpenGL-only feature. Half-Life and Unreal do this better, they support colored lighting in their software mode.
Re:I Love Software Rendering on Friday October 16, 2026 @09:39AM (#50118279)
> Games worth trying

I can add more:

Unreal (and Unreal Tournament), Thief, Quake II (a slight improvement over Quake), Half-Life (a great improvement over Quake), Shadow Warrior, Any modern port of Doom supporting software rendering, Heretic, Hexen, Descent, System Shock, Homeworld.

Re:I Love Software Rendering on Friday October 16, 2026 @09:34AM (#50118211)
I too. So that I have written many software renderers in many years. A video with my recent project having a software renderer: https://www.youtube.com/watch?v=NepOPAPDvwA
Re:The Double Headed Stack Allocator on Thursday October 15, 2026 @01:22AM (#50099509)
> Imagine that you had a streaming world game where as the player ran around the world, old level geometry would deallocate, and new level geometry would allocate and stream in from disk.

In such case stack-like allocator isn't the best strategy. One can use some sort of cyclic allocator instead. As I know Quake did this for surfaces cache.

Re:The Double Headed Stack Allocator on Thursday October 15, 2026 @01:19AM (#50099489)
> Once again, these allocators work fine in multithreaded environments

How? As I understand, for such double-headed allocator to be multithreaded one needs to update two counters atomically, which is tricky.

Re:A Modern Web App in C on Monday October 12, 2026 @12:59PM (#50059299)
> There's no separate database server. You open the database file through SQLite's C API.

> Every request spawns a fresh process.

How does it work when multiple concurrent requests are possible? Does SQLite allow simultaneous write access from multiple processes?

Re:Fingerprints Are the New Cookies on Monday October 12, 2026 @06:47AM (#50054411)
> A news site doesn't need to do audio processing on my machine and read back the buffer? It doesn't need to use webgl to render triangles to an offscreen buffer?

We should go further. A web-site with mostly static content should not use user-side scripting (Javascript) at all, it's unnecessary for it. It should be required only in rare cases where a site is basically an application and require manually turning it on each time such application is opened.

Re:Valen's Memory Safety: A New Kind of Borrow Checking on Monday October 12, 2026 @01:50AM (#50051844)
Try my language: https://github.com/Panzerschrek/U-00DC-Sprache/. It's memory safe (as Rust), but is way simpler (no explicit borrowing and traits hell) and it's already pretty developed (not in an experimental stage).
Re:Valen's Memory Safety: A New Kind of Borrow Checking on Monday October 12, 2026 @01:46AM (#50051822)
The ability to hold a reference to a container and its member seems to be interesting. But I don't think it adds significant value in practice (behind some synthesized examples) and doesn't worth to increase language complexity language compared for a more coarse reference analysis (variable-based).
Re:Valen's Memory Safety: A New Kind of Borrow Checking on Monday October 12, 2026 @01:41AM (#50051801)
> the compiler remembers where a reference points to

> So we spent months sharpening the explanation and figuring out its benefits, and wrote a post 8 on it last year, hoping other languages would pick it up.

My language (see my submissions) has this feature since many years. In its current form it exists roughly since year 2020, but some under-the-hood changes and slight improvements have been done since.

Older »