Likelihood That (CHAR_BIT == 8). - c++

This is a discussion on Likelihood That (CHAR_BIT == 8). - c++ ; Hi All, I would like to know of existing systems where CHAR_BIT of <climits> is not equal to 8. I am particular interested in prevalent systems. Technically, my code is mostly portable, but only within a particular machine. Innter-machine interaction ...

+ Reply to Thread
Results 1 to 7 of 7

Likelihood That (CHAR_BIT == 8).

  1. Default Likelihood That (CHAR_BIT == 8).

    Hi All,

    I would like to know of existing systems where CHAR_BIT of <climits>
    is not equal to 8. I am particular interested in prevalent systems.

    Technically, my code is mostly portable, but only within a particular
    machine. Innter-machine interaction (serialization for example), there
    will be problems for those machines where CHAR_BIT != 8.

    Yes, yes, I know, it enough effort, I can rewrite my code to eliminate
    any potential compatibilities even then, but still, it helps to
    know.

    TIA,

    -Le Chaud Lapin-

    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  2. Default Re: Likelihood That (CHAR_BIT == 8).

    On 10 ???, 07:23, Le Chaud Lapin <jaibudu...@gmail.com> wrote:
    > Hi All,
    >
    > I would like to know of existing systems where CHAR_BIT of <climits>
    > is not equal to 8. I am particular interested in prevalent systems.
    >
    > Technically, my code is mostly portable, but only within a particular
    > machine. Innter-machine interaction (serialization for example), there
    > will be problems for those machines where CHAR_BIT != 8.


    Likelihood depends on what you are targeting. But, to give a few
    specific examples - some DSPs cannot operate on individual octets, so
    char is whatever the word size of the architecture is - e.g. 32-bit.
    There was a link to documentation for a C++ compiler for such a
    platform (SHARC) given earlier in a thread titled "mixed-sign
    arithmetic and auto" (which I would recommend to read, by the way - it
    has some more information somewhat relevant to the topic) - here it
    is:

    http://www.****og.com/UploadedFiles/...ARC_cc_man.pdf

    Apparently, this one has 32-bit char, and, as a consequence,
    sizeof(int)==sizeof(char)==1


    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  3. Default Re: Likelihood That (CHAR_BIT == 8).

    On 10 Maj, 05:23, Le Chaud Lapin <jaibudu...@gmail.com> wrote:
    > Hi All,
    >
    > I would like to know of existing systems where CHAR_BIT of <climits>
    > is not equal to 8. I am particular interested in prevalent systems.
    >
    > Technically, my code is mostly portable, but only within a particular
    > machine. Innter-machine interaction (serialization for example), there
    > will be problems for those machines where CHAR_BIT != 8.
    >
    > Yes, yes, I know, it enough effort, I can rewrite my code to eliminate
    > any potential compatibilities even then, but still, it helps to
    > know.


    Probably a lot of CPU's have CHAR_BIT = 16 or 32. If you plan for
    porting your code to e.g. cellphones and PDAs you are likely to get
    into troubles (I've programmed on a PDA that had CHAR_BIT = 16).
    If you turn into more exotic architectures you are of course even more
    likely to experience problems.

    /Peter

    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  4. Default Re: Likelihood That (CHAR_BIT == 8).

    Le Chaud Lapin wrote:
    > Hi All,
    >
    > I would like to know of existing systems where CHAR_BIT of <climits>
    > is not equal to 8. I am particular interested in prevalent systems.
    >
    > Technically, my code is mostly portable, but only within a particular
    > machine. Innter-machine interaction (serialization for example), there
    > will be problems for those machines where CHAR_BIT != 8.
    >
    > Yes, yes, I know, it enough effort, I can rewrite my code to eliminate
    > any potential compatibilities even then, but still, it helps to
    > know.


    There are still a few 36-bit DEC machines running
    (try Telnet to "DEC-10.PDPplanet.COM") and some Unisys
    B series mainframes running 36-bit OS/2200. But when Unisys
    discontinued the ClearPath 36-bit server line last year, in favor of software
    emulation of the 36-bit machines for old code, commercial production of the
    last non-byte-oriented hardware ended.

    So you probably don't have to support char sizes other than 8.

    Here, for fun, is a useful piece of C code written to work portably across
    7, 8, and 9-bit character sizes. This tests passwords for "obviousness"
    without needing a dictionary file.

    http://www.animats.com/source/obvious/obvious.c

    John Nagle



    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  5. Default Re: Likelihood That (CHAR_BIT == 8).

    Le Chaud Lapin wrote:
    > Hi All,
    >
    > I would like to know of existing systems where CHAR_BIT of <climits>
    > is not equal to 8. I am particular interested in prevalent systems.
    >
    > Technically, my code is mostly portable, but only within a particular
    > machine. Innter-machine interaction (serialization for example), there
    > will be problems for those machines where CHAR_BIT != 8.


    Some TI DSPs have CHAR_BIT==16.

    So long,
    Thomas

    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  6. Default Re: Likelihood That (CHAR_BIT == 8).

    Le Chaud Lapin wrote:

    > Hi All,
    >
    > I would like to know of existing systems where CHAR_BIT of <climits>
    > is not equal to 8. I am particular interested in prevalent systems.


    I am currently developing software for the BlueCore-5 chip (a Bluetooth
    chip from Cambridge Silicon Radio, www.csr.com) which has CHAR_BIT ==
    16.

    >
    > Technically, my code is mostly portable, but only within a particular
    > machine. Innter-machine interaction (serialization for example), there
    > will be problems for those machines where CHAR_BIT != 8.


    The communication might not be a problem for the BlueCore chip. It often
    uses octet-oriented communication mechanisms (UART and I2C) and handles
    the conversion between byte and octet internally.
    Other processors that often interface over octet-oriented mechanisms
    might do the same.

    >
    > Yes, yes, I know, it enough effort, I can rewrite my code to eliminate
    > any potential compatibilities even then, but still, it helps to
    > know.
    >
    > TIA,
    >
    > -Le Chaud Lapin-
    >

    Bart v Ingen Schenau
    --
    a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
    c.l.c FAQ: http://c-faq.com/
    c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


  7. Default Re: Likelihood That (CHAR_BIT == 8).

    On May 10, 8:14 am, John Nagle <na...@animats.com> wrote:
    <snip>

    > There are still a few 36-bit DEC machines running
    > (try Telnet to "DEC-10.PDPplanet.COM") and some Unisys
    > B series mainframes running 36-bit OS/2200. But when Unisys
    > discontinued the ClearPath 36-bit server line last year, in favor of

    software
    > emulation of the 36-bit machines for old code, commercial production of

    the
    > last non-byte-oriented hardware ended.


    Has production of supercomputers ended, too?

    Supercomputers generally don't have (hardware) access
    for units smaller than one word, for efficiency reasons.
    E.g., CDC 6600/7600 series, Crays, etc.

    I used to run C++ programs on supercomputers, and there
    is a subgroup of the C++ standards group interested in
    C++ for numerical applications, so they are
    relevant to this group.

    > So you probably don't have to support char sizes other than 8.


    I believe Cray (64-bit word) compilers emulate(d) 8-bit
    access, so "char" is still 8 bits. It does mean that
    handling of "char" variables and arrays is extremely
    inefficient, but byte-oriented computation forms an
    infinitesimal part of these machines' workload, so it
    doesn't matter.

    The CDC machines have/had 60-bit words. I never did
    any C programming on them (let alone C++), so I don't
    know if "char" was 6, 8, or 10 bits on them. The
    CDC operating systems used 6-bit characters, but also
    sometimes stored 15 8-bit characters in 2 words.

    I don't know if they are still manufacturing this
    architecture, though.

    --
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]


+ Reply to Thread