limits constatnts

R

Ravi Uday

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
 
M

Michael Mair

Ravi said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top