in reply to Re^3: word size
in thread word size

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.)

Replies are listed 'Best First'.
Re^5: word size
by BrowserUk (Patriarch) on Sep 09, 2005 at 00:22 UTC
    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.

      Here, char doesn't mean character, but the char type in C. That char corresponds to my idea of a byte, but of course, in some cases it might be different from what a byte really is according to the CPU. Whatever, $Config{ivsize} and the other macros give the size of an IV in chars.