limits constatnts

Discussion in 'C Programming' started by Ravi Uday, Oct 5, 2005.

  1. Ravi Uday

    Ravi Uday Guest

    Hi,
    I have this in my limits.h file.

    #if __INT_BITS__-0 == 64
    #define LLONG_MIN (-9223372036854775807-1) /* minimum value of a
    long long */
    #define LLONG_MAX 9223372036854775807 /* maximum value of a
    long long */
    #define ULLONG_MAX 18446744073709551615U /* maximum value of an
    unsigned long long */
    #else
    #if defined(__WATCOM_INT64__)
    #define LLONG_MIN (-9223372036854775807I64-1) /* minimum value of a
    long long */
    #define LLONG_MAX 9223372036854775807I64 /* maximum value of a
    long long */
    #define ULLONG_MAX 18446744073709551615UI64 /* maximum value of an
    unsigned long long */
    #else
    #define LLONG_MIN (-9223372036854775807LL-1) /* minimum value of a
    long long */
    #define LLONG_MAX 9223372036854775807LL /* maximum value of a
    long long */
    #define ULLONG_MAX 18446744073709551615ULL /* maximum value of an
    unsigned long long */
    #endif
    #endif

    can some-one help me with the defns.
    Is unsigned long = unsigned int = unsinged long long ! in this case? (if
    so why did they define that way )
    (#define UINT_MAX 18446744073709551615U)
    we use mips64, so which is the value of unsigned int long long it picks up.

    TIA
    - Ravi
    Ravi Uday, Oct 5, 2005
    #1
    1. Advertising

  2. Ravi Uday

    Michael Mair Guest

    Ravi Uday wrote:
    > Hi,
    > I have this in my limits.h file.
    >
    > #if __INT_BITS__-0 == 64
    > #define LLONG_MIN (-9223372036854775807-1) /* minimum value of a
    > long long */
    > #define LLONG_MAX 9223372036854775807 /* maximum value of a
    > long long */
    > #define ULLONG_MAX 18446744073709551615U /* maximum value of an
    > unsigned long long */
    > #else
    > #if defined(__WATCOM_INT64__)
    > #define LLONG_MIN (-9223372036854775807I64-1) /* minimum value of a
    > long long */
    > #define LLONG_MAX 9223372036854775807I64 /* maximum value of a
    > long long */
    > #define ULLONG_MAX 18446744073709551615UI64 /* maximum value of an
    > unsigned long long */
    > #else
    > #define LLONG_MIN (-9223372036854775807LL-1) /* minimum value of a
    > long long */
    > #define LLONG_MAX 9223372036854775807LL /* maximum value of a
    > long long */
    > #define ULLONG_MAX 18446744073709551615ULL /* maximum value of an
    > unsigned long long */
    > #endif
    > #endif
    >
    > can some-one help me with the defns.
    > Is unsigned long = unsigned int = unsinged long long ! in this case? (if
    > so why did they define that way )
    > (#define UINT_MAX 18446744073709551615U)
    > we use mips64, so which is the value of unsigned int long long it picks up.


    In which case? You have three cases:
    1) 64 bit ints -> long long can have the same representation as int,
    so, yes they are the same. The implementation is free to do that.
    2) Watcom 64 bit integers -> these become long long
    3) Everything else -> you have "ordinary" long long ints.

    So, which of them is true.
    If you do not know, then rebuild the conditional compilation
    structure and work with #error to find out at compile time or
    printf() otherwise. Or consult your implementation's
    documentation which is what one would expect you to do in the first
    place...


    -Michael
    --
    E-Mail: Mine is an /at/ gmx /dot/ de address.
    Michael Mair, Oct 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jack
    Replies:
    0
    Views:
    6,056
  2. Ashish
    Replies:
    1
    Views:
    3,122
    Natty Gur
    Nov 19, 2003
  3. Jerry Camel

    File Upload Limits

    Jerry Camel, Feb 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    369
    Ken Cox [Microsoft MVP]
    Feb 21, 2004
  4. Joe Van Meer
    Replies:
    2
    Views:
    622
    Peter O'Reilly
    May 5, 2004
  5. =?Utf-8?B?cGJ1bQ==?=

    GDI+ - limits for pixel dimensions in a bitmap object

    =?Utf-8?B?cGJ1bQ==?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    340
    =?Utf-8?B?cGJ1bQ==?=
    Jun 18, 2004
Loading...

Share This Page