149
Comments
  • 2
    At work we have a table hockey game with Sweden vs. Finland. I usually play Finland, because if I lose I can still be happy that Sweden wins.
  • 2
    Isn't it hilarious that booleans use up 8bits in RAM? At least we learned it in class
  • 0
    @ThatDude Formally no, but emotionally and culturally yes :)
  • 0
    Quincy ❤
  • 2
    In programming, being off by a bit can turn your life upside down.
  • 0
    @Lahsen2016 I knew that, but it's still hilarious isn't it? High technology but still such basic issues
  • 2
    @SteffTek it's much more complicated than that. It depends on the language, hardware, and I'm sure other things
  • 0
    I think a boolean takes 8Bits of memory, because you can only adress Bytes at your RAM.
    The Problem ist the accessing by a variable, because a pointer to RAM only points to the byte, not the specific bit.
    Otherwise you can use a bit vector, which is a series of 0s and 1s and contains 8 booleans per Byte
  • 2
    @realLifeMock like I said it depends on the language, and the software. What you are saying is totally true for some platforms, and very wrong on just as many different platforms. There are platforms where a Boolean is a bit, or at least there could be.

    Also it could be larger too (by C++ definition).
  • 1
    @Lahsen2016 @SteffTek that's because a byte is the smallest amount of addressable memory. You could work around that with bitwise operations or bitfields, but that's really not worth it

    And in some languages (namely C) a bool isn't even a single byte, it's being represented by an int
  • 0
    @Lahsen2016 yes, of course, but I was referring to stdbool.h ^^
Add Comment