in reply to Re: word size
in thread word size

The problem is, that all those sizes are in bytes, not bits. I'm not sure how you can compute the size of something in bits using Config, as it doesn't tell the number of bits in characters. Maybe you could use something like ivsize/i32size*32.

Replies are listed 'Best First'.
Re^3: word size
by BrowserUk (Patriarch) on Sep 08, 2005 at 22:16 UTC

    Hmm. Now I know there have been machines with 6-bit bytes, and (maybe) 9-bit bytes, in the dark distant past, but I'm not aware of any remotely modern cpu that doesn't use 8-bit bytes?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

      For a current machine (one on which Perl runs) 6 bit bytes are surely impossible, and I belive that 9 bit bytes don't exist any more: everyone works in multiples of 8 bytes. I think that this dominance of 8 bits is a consequence of the internet. It would be even more difficult to transfer binary data (like the IP and TCP header for example) from one machine to the other than now if they differed not only in word size and byte order, but this way. Also, even without the internet, all current hardware, such hard disks, video cards, work with multiples of 8 bits.

      However, there can be (rare) machines where the char can be 32 or 16 bits. This can be either because the CPU doesn't handle 8-bit numbers efficently; or it could be because it's impossible to implement C on that CPU with char being 8 bits for some other obscure reason. (In this case, sizeof(char) will still be 1, because sizeof, malloc, and other C functions would count in units of chars.)

        everyone works in multiples of 8 bytes. I think that this dominance of 8 bits is a consequence of the internet

        I'd put it down to the fact that computer manufacturers don;t make their own memory any more, but buy in standard parts.

        However, there can be (rare) machines where the char can be 32 or 16 bits.

        But char != byte.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.