• 0 Posts
  • 6 Comments
Joined 2 months ago
cake
Cake day: May 12th, 2025

help-circle
  • There are a few reasons you shouldn’t use this in proper programs. If you’re the sort of person that thinks hacky Bash scripts are acceptable then sure, use it there.

    1. It isn’t cross-platform. Not available on Mac/Windows.
    2. There are several types of UUID with different properties. This doesn’t let you choose which one to use.
    3. To make programs deterministic (really useful for testing!) you want to be able to seed all their randomness with a specific seed so that it generates the same UUID each time you run it. (Obviously in normal use you would use a random seed.)


  • but if you have a single bool in a stack frame it’s probably going to be more than a byte.

    Nope. - if you can’t read RISC-V assembly, look at these lines

            sb      a5,-17(s0)
    ...
            sb      a5,-18(s0)
    ...
            sb      a5,-19(s0)
    ...
    

    That is it storing the bools in single bytes. Also I only used RISC-V because I’m way more familiar with it than x86, but it will do the same thing.

    on the heap definitely more than a byte

    Nope, you can happily malloc(1) and store a bool in it, or malloc(4) and store 4 bools in it. A bool is 1 byte. Consider this a TIL moment.