Re: Integer sizes

From: Dan W. (danw_at_raytron-controls.com)
Date: 12/04/03


Date: Thu, 04 Dec 2003 01:23:36 -0500

On Thu, 4 Dec 2003 16:10:07 +1100, "David Fisher"
<nospam@nospam.nospam.nospam> wrote:

>The most common sizes of integer types seem to be:
>
>8 bits - signed char
>16 bits - short
>16 or 32 bits - int
>32 or 64 bits - long
>
>Question #1:
>
>Does anyone know how common sizes other than these are ? I know that the
>standard says that number of bits in a "byte" (char) is >= 8, but I have not
>come across values other than these yet ...
>
>Question #2:
>
>Is anyone aware of a package that has some portable definitions of things
>like Int8, Int16 and Int32 (assuming they are possible for the platform) ?
>If not, I think you could do this using the definitions in <limits.h>
>(<climits> ?). I am aware that the preprocessor doesn't understand the
>sizeof operator, so you can't do it that way.

I work with a C compiler for which, by default, int is 8 bits.

Personally, I HATE all this business of int, long, long long, double,
double double, and all this incomprehensible crap. *And Non-Portable
Crap, I might add*. Most compilers come with headers, I believe,
where they define numeric types more inteligently, like

__INT08
__INT16
...
__UINT08
__UINT16

and so on. I haven't used them myself, possibly because of the extra
typing (keyboard typing I mean), and to play along with existing code.
There must be, though I can't tell you for sure, standard conforming
and comprehensible numeric types.

I sure hope something is done about this, and real soon, to help us
rid ourselves of "int" and all that.

Yours.
dan



Relevant Pages

  • Re: Integer sizes
    ... >>Does anyone know how common sizes other than these are? ... > I work with a C compiler for which, by default, int is 8 bits. ... > where they define numeric types more inteligently, ... > typing (keyboard typing I mean), and to play along with existing code. ...
    (comp.lang.cpp)
  • Re: Interesting list Validity (True/False)
    ... different string types, never compare equal; ... Why should the int 1 return True when compared to mpz? ... of shoes is not the same as a box of shoes, even if they are the same ... numeric types, so the earlier rule applies: ...
    (comp.lang.python)
  • Re: The smallest and largest values of numeric types
    ... Lou Pecora wrote: ... How can I determine the smallest and largest values of numeric types ... (for example int) ... "I have come to believe that the whole world is an enigma, a harmless enigma ...
    (comp.lang.python)
  • Re: Struct a lightweight class type having value based semantics?
    ... Computer scientists have worked on defining type ... (i'm still a bit confused about about native types like int etc.. ... users of the language cannot define new numeric types. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: The smallest and largest values of numeric types
    ... of numeric types (for example int) possible in my ... For floats, ... # Determine max binary digits for float on this system. ...
    (comp.lang.python)