Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. Tell me the truth ...

Tell me the truth ...

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
32 Posts 20 Posters 3 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V [email protected]

    Let's store the boolean there then!!

    A This user is from outside of this forum
    A This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #23

    That boolean can indicate if it's a fancy character, that way all ASCII characters are themselves but if the boolean is set it's something else. We could take the other symbol from a page of codes to fit the users language.
    Or we could let true mean that the character is larger, allowing us to transform all of unicode to a format consisting of 8 bits parts.

    1 Reply Last reply
    0
    • A [email protected]

      It's not wasteful, it's faster. You can't read one byte, you can only read one word. Every decent compiler will turn booleans into words.

      T This user is from outside of this forum
      T This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #24

      You can’t read one byte

      lol what. You can absolutely read one byte: https://godbolt.org/z/TeTch8Yhd

      On ARM it's ldrb (load register byte), and on RISC-V it's lb (load byte).

      Every decent compiler will turn booleans into words.

      No compiler I know of does this. I think you might be getting confused because they're loaded into registers which are machine-word sized. But in memory a bool is always one byte.

      A 1 Reply Last reply
      0
      • E [email protected]

        Could you provide an example?

        T This user is from outside of this forum
        T This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #25

        The biggest problem is that each element doesn't have a unique memory address; iterators aren't just pointers.

        1 Reply Last reply
        0
        • B [email protected]

          things that store it as word size for alignment purposes (most common afaik), things that pack multiple books into one byte (normally only things like bool sequences/structs), etc

          T This user is from outside of this forum
          T This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #26

          things that store it as word size for alignment purposes

          Nope. bools only need to be naturally aligned, so 1 byte.

          If you do

          struct SomeBools {
            bool a;
            bool b;
            bool c;
            bool d;
          };
          

          its 4 bytes.

          B 1 Reply Last reply
          0
          • H [email protected]

            How does that work?

            T This user is from outside of this forum
            T This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #27

            I think he's talking about if a variable only exists in registers. In which case it is the size of a register. But that's true of everything that gets put in registers. You wouldn't say uint16_t is word-sized because at some point it gets put into a word-sized register. That's dumb.

            1 Reply Last reply
            0
            • T [email protected]

              things that store it as word size for alignment purposes

              Nope. bools only need to be naturally aligned, so 1 byte.

              If you do

              struct SomeBools {
                bool a;
                bool b;
                bool c;
                bool d;
              };
              

              its 4 bytes.

              B This user is from outside of this forum
              B This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #28

              sure, but if you have a single bool in a stack frame it's probably going to be more than a byte. on the heap definitely more than a byte

              1 Reply Last reply
              0
              • T [email protected]

                You can’t read one byte

                lol what. You can absolutely read one byte: https://godbolt.org/z/TeTch8Yhd

                On ARM it's ldrb (load register byte), and on RISC-V it's lb (load byte).

                Every decent compiler will turn booleans into words.

                No compiler I know of does this. I think you might be getting confused because they're loaded into registers which are machine-word sized. But in memory a bool is always one byte.

                A This user is from outside of this forum
                A This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #29

                Sorry, but you're very confused here.

                1 Reply Last reply
                0
                • M [email protected]

                  This reminds me that I actually once made a class to store bools packed in uint8 array to save bytes.

                  Had forgotten that. I think i have to update the list of top 10 dumbest things i ever did.

                  rikudou@lemmings.worldR This user is from outside of this forum
                  rikudou@lemmings.worldR This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #30

                  Ah, the creator od std::vector<bool>?

                  1 Reply Last reply
                  0
                  • B [email protected]

                    The alignment of the language and the alignment of the coder must be similar on at least one metric, or the coder suffers a penalty to develop for each degree of difference from the language's alignment. This is penalty stacks for each phase of the project.

                    So, let's say that the developer is a lawful good Rust zealot Paladin, but she's developing in Python, a language she's moderately familiar with. Since Python is neutral/good, she suffers a -1 penalty for the first phase, -2 for the second, -3 for the third, etc. This is because Rust (the Paladin's native language) is lawful, and Python is neutral (one degree of difference from lawful), so she operates at a slight disadvantage. However, they are both "good", so there's no further penalty.

                    The same penalty would occur if using C, which is lawful neutral - but the axis of order and chaos matches, and there is one degree of difference on the axis of good and evil.

                    However, if that same developer were to code in Javascript (chaotic neutral), it would be at a -3 (-6, -9...) disadvantage, due to 2 and 1 degree of difference in alignment, respectively.

                    Malbolge (chaotic evil), however, would be a -4 (-8, -12) plus an inherent -2 for poor toolchain availability.

                    ..hope this helps. have fun out there!

                    S This user is from outside of this forum
                    S This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #31

                    If JS is chaotic neutral, what then is chaotic evil?

                    All I'm saying is

                    "10" + 1 => "101"
                    "10" - 1 => 9
                    "a" - "b" => NaN
                    
                    B 1 Reply Last reply
                    0
                    • S [email protected]

                      If JS is chaotic neutral, what then is chaotic evil?

                      All I'm saying is

                      "10" + 1 => "101"
                      "10" - 1 => 9
                      "a" - "b" => NaN
                      
                      B This user is from outside of this forum
                      B This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #32

                      fair enough. My personal opinion might be that it's evil, but perhaps that's because I expected some kind of order.

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups