LLONG_MAX vs ULLONG_MAX

  • Thread starter Mathieu Malaterre
  • Start date
M

Mathieu Malaterre

Hello,

Can anyone confirm which one is which: it seems that ULLONG_MAX is only
c99, whereas LLONG_MAX is c89. It doesn't make much sense since I would
expect both would be defined *or* none of them.

Thanks for confirmation
Mathieu
 
R

Rob Williscroft

Mathieu Malaterre wrote in
in comp.lang.c++:
Hello,

Can anyone confirm which one is which: it seems that ULLONG_MAX
is only
c99, whereas LLONG_MAX is c89. It doesn't make much sense since I
would expect both would be defined *or* none of them.

Wrong newsgroup, neither of the above are part of C++.

Ask in comp.lang.c (Note *no* ++).

Rob.
 
V

Victor Bazarov

Rob Williscroft said:
Mathieu Malaterre wrote in
in comp.lang.c++:


Wrong newsgroup, neither of the above are part of C++.

True. But C89 (C90, actually) _is_. And LONG_MAX and ULONG_MAX are
also part of C++. We can only conclude that LLONG_MAX is _not_ part
of C89. So, essentially, Mathieu is correct, neither of them is in
C89 (C90) and both are in C99.
Ask in comp.lang.c (Note *no* ++).

Wouldn't hurt.

V
 
K

Karthik Kumar

Mathieu said:
Hello,

Can anyone confirm which one is which: it seems that ULLONG_MAX is
only c99, whereas LLONG_MAX is c89. It doesn't make much sense since I
would expect both would be defined *or* none of them.


Thanks for confirmation
Mathieu

D:\>type longlongint.c
#include <stdlib.h>

int main() {
long long int a;
unsigned long long int b;

return EXIT_SUCCESS;
}


D:\>gcc -Wall -ansi -pedantic longlongint.c
longlongint.c: In function `main':
longlongint.c:4: warning: ISO C90 does not support `long long'
longlongint.c:5: warning: ISO C90 does not support `long
long' longlongint.c:4: warning: unused variable `a'
longlongint.c:5: warning: unused variable
`b'


In c99 standard, 5.2.4.2.1 Size of integer limits ,

"
— maximum value for an object of type long long int
LLONG_MAX +9223372036854775807 // 2^63 - 1
— maximum value for an object of type unsigned long long int
ULLONG_MAX 18446744073709551615 // 2^64 - 1
"

So since those types are not defined in c89, the two macros could not
have been defined in c89 either.
 

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

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,517
Latest member
Andres38A1

Latest Threads

Top