• 0 Posts
  • 8 Comments
Joined 3 years ago
cake
Cake day: June 21st, 2023

help-circle


  • The final example just boils down to writing the whole program in assembly, doesn’t it? The C function just returns a pointer to a static string, which you might as well do in assembly yourself since it’s less code to do it that way (you can omit the whole function signature).

    In any case, the article does a great job introducing the various compilation stages the C program goes through in order to become an executable.


  • A byte can hold one of 256 values (0–255), and luckily there are way more than 256 blocks in Minecraft, so I can hand every single byte its own block.

    This was not always the case. It is now since they moved (many years ago) to their new ID format, but at one point there were less than 256 blocks, and items would start at ID 256 (Iron Shovel). Not super relevant today of course, but just a fun bit of history.

    Anyway, two other things come to mind:

    1. You could encode files directly into NBT data for an item or entity. You might need to split files across multiple tags though. It’d be funny to see armor stands representing files on disk, for example.
    2. You don’t need to map bytes 1:1 to blocks. It’s possible to have a palette of more than 256 blocks, and encode the data in a different base, like say base 300 or so, to make the encoded data more (spatially) compact.

    Cool project. It’s a fun idea.



  • To be honest I don’t see how a “style guide” is going to help. C++ has had all sorts of guidelines and style guides for decades and it helps a bit but… not really.

    It does help though without requiring a complete rewrite in another language, which is prone to causing entirely new issues and reintroducing old, fixed ones.

    Like I said, Rust does a much better job at avoiding these. “Claude rewrite this in Rust” doesn’t give you those benefits for free.

    Is this style guide not a style guide?

    It’s a start, but doesn’t say much about methods to avoid the memory issues that they supposedly had issues with. If they intended to actually use it, maybe it’d have more than 7 commits from 8 months ago. Maybe they would have updated it with patterns to prevent new bugs in the future based on the bugs they ran into. That didn’t happen, though.