QNX 6.2 and long long

It’s a little program test.cc

#include <sys/neutrino.h>
#include <inttypes.h>
#include <stdio.h>
main( void )
{
long long res;
printf( “LONGLONG_MIN = %lld\n”, LONGLONG_MIN );
res = LONGLONG_MIN;
printf( “res = %lld\n”, res );
printf( “LONGLONG_MAX = %lld\n”, LONGLONG_MAX );
res = LONGLONG_MAX;
printf( “res = %lld\n”, res );
}

When I compiling it under QNX 6.2 :
gcc -otest_c test.c all working OK
and ./test_c

LONGLONG_MIN = -9223372036854775808
res = -9223372036854775808
LONGLONG_MAX = 9223372036854775807
res = 9223372036854775807

When rename test.c to test.cc and try
gcc -otest_cc test.cc
test.cc: In function int main()': test.cc:8: integer constant out of range test.cc:8: warning: decimal integer constant is so large that it is unsigned test.cc:9: integer constant out of range test.cc:9: warning: decimal integer constant is so large that it is unsigned test.cc:11: integer constant out of range test.cc:11: warning: decimal integer constant is so large that it is unsigned test.cc:12: integer constant out of range test.cc:12: warning: decimal integer constant is so large that it is unsigned and gcc not make programm test_cc. When I try gcc -pedantic -otest_cc test.cc test.cc:6: warning: ANSI C++ forbids declaration main’ with no type
test.cc: In function int main()': test.cc:7: warning: ANSI C++ does not support long long’
test.cc:8: warning: integer constant out of range
test.cc:8: warning: decimal integer constant is so large that it is unsigned
test.cc:9: warning: integer constant out of range
test.cc:9: warning: decimal integer constant is so large that it is unsigned
test.cc:11: warning: integer constant out of range
test.cc:11: warning: decimal integer constant is so large that it is
unsigned
test.cc:12: warning: integer constant out of range
test.cc:12: warning: decimal integer constant is so large that it is
unsigned

gcc make test_cc but
…/test_cc
LONGLONG_MIN = 577732285961338880
res = 0
LONGLONG_MAX = 4294967295
res = 9223372036854775807
Under QNX 6.1 all makes wery well test_c and test_cc - no warning no
erros. test_cc i do withaout -pedantic
Why under QNX 6.2 it not working ?
Best Regards,

Bogdan

Thanks, there’s a problem in limits.h with the definition
of LONGLONG_MAX and LONGLONG_MIN (they are missing the LL
qualifier)

Bogdan Celer <bogdan@xserwis.com.pl> wrote:

It’s a little program test.cc

#include <sys/neutrino.h
#include <inttypes.h
#include <stdio.h
main( void )
{
long long res;
printf( “LONGLONG_MIN = %lld\n”, LONGLONG_MIN );
res = LONGLONG_MIN;
printf( “res = %lld\n”, res );
printf( “LONGLONG_MAX = %lld\n”, LONGLONG_MAX );
res = LONGLONG_MAX;
printf( “res = %lld\n”, res );
}

When I compiling it under QNX 6.2 :
gcc -otest_c test.c all working OK
and ./test_c

LONGLONG_MIN = -9223372036854775808
res = -9223372036854775808
LONGLONG_MAX = 9223372036854775807
res = 9223372036854775807

When rename test.c to test.cc and try
gcc -otest_cc test.cc
test.cc: In function int main()': test.cc:8: integer constant out of range test.cc:8: warning: decimal integer constant is so large that it is unsigned test.cc:9: integer constant out of range test.cc:9: warning: decimal integer constant is so large that it is unsigned test.cc:11: integer constant out of range test.cc:11: warning: decimal integer constant is so large that it is unsigned test.cc:12: integer constant out of range test.cc:12: warning: decimal integer constant is so large that it is unsigned and gcc not make programm test_cc. When I try gcc -pedantic -otest_cc test.cc test.cc:6: warning: ANSI C++ forbids declaration main’ with no type
test.cc: In function int main()': test.cc:7: warning: ANSI C++ does not support long long’
test.cc:8: warning: integer constant out of range
test.cc:8: warning: decimal integer constant is so large that it is unsigned
test.cc:9: warning: integer constant out of range
test.cc:9: warning: decimal integer constant is so large that it is unsigned
test.cc:11: warning: integer constant out of range
test.cc:11: warning: decimal integer constant is so large that it is
unsigned
test.cc:12: warning: integer constant out of range
test.cc:12: warning: decimal integer constant is so large that it is
unsigned

gcc make test_cc but
./test_cc
LONGLONG_MIN = 577732285961338880
res = 0
LONGLONG_MAX = 4294967295
res = 9223372036854775807
Under QNX 6.1 all makes wery well test_c and test_cc - no warning no
erros. test_cc i do withaout -pedantic
Why under QNX 6.2 it not working ?
Best Regards,

Bogdan


cburgess@qnx.com

I noticed this too…what the heck is that INT_BITS define? The only
difference if it’s == 64 is the LL suffix. Weird.

Kris
“Colin Burgess” <cburgess@qnx.com> wrote in message
news:a5jlkf$731$1@nntp.qnx.com

Thanks, there’s a problem in limits.h with the definition
of LONGLONG_MAX and LONGLONG_MIN (they are missing the LL
qualifier)

Bogdan Celer <> bogdan@xserwis.com.pl> > wrote:
It’s a little program test.cc

#include <sys/neutrino.h
#include <inttypes.h
#include <stdio.h
main( void )
{
long long res;
printf( “LONGLONG_MIN = %lld\n”, LONGLONG_MIN );
res = LONGLONG_MIN;
printf( “res = %lld\n”, res );
printf( “LONGLONG_MAX = %lld\n”, LONGLONG_MAX );
res = LONGLONG_MAX;
printf( “res = %lld\n”, res );
}

When I compiling it under QNX 6.2 :
gcc -otest_c test.c all working OK
and ./test_c

LONGLONG_MIN = -9223372036854775808
res = -9223372036854775808
LONGLONG_MAX = 9223372036854775807
res = 9223372036854775807

When rename test.c to test.cc and try
gcc -otest_cc test.cc
test.cc: In function int main()': test.cc:8: integer constant out of range test.cc:8: warning: decimal integer constant is so large that it is unsigned test.cc:9: integer constant out of range test.cc:9: warning: decimal integer constant is so large that it is unsigned test.cc:11: integer constant out of range test.cc:11: warning: decimal integer constant is so large that it is unsigned test.cc:12: integer constant out of range test.cc:12: warning: decimal integer constant is so large that it is unsigned and gcc not make programm test_cc. When I try gcc -pedantic -otest_cc test.cc test.cc:6: warning: ANSI C++ forbids declaration main’ with no type
test.cc: In function int main()': test.cc:7: warning: ANSI C++ does not support long long’
test.cc:8: warning: integer constant out of range
test.cc:8: warning: decimal integer constant is so large that it is
unsigned
test.cc:9: warning: integer constant out of range
test.cc:9: warning: decimal integer constant is so large that it is
unsigned
test.cc:11: warning: integer constant out of range
test.cc:11: warning: decimal integer constant is so large that it is
unsigned
test.cc:12: warning: integer constant out of range
test.cc:12: warning: decimal integer constant is so large that it is
unsigned

gcc make test_cc but
./test_cc
LONGLONG_MIN = 577732285961338880
res = 0
LONGLONG_MAX = 4294967295
res = 9223372036854775807
Under QNX 6.1 all makes wery well test_c and test_cc - no warning no
erros. test_cc i do withaout -pedantic
Why under QNX 6.2 it not working ?
Best Regards,

Bogdan


\

cburgess@qnx.com

Kris Warkentin <kewarken@qnx.com> wrote:

I noticed this too…what the heck is that INT_BITS define? The only
difference if it’s == 64 is the LL suffix. Weird.

My guess – its defining the number of bits in a native “int” for that
platform, 16, 32, 64.

-David


Kris
“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:a5jlkf$731$> 1@nntp.qnx.com> …
Thanks, there’s a problem in limits.h with the definition
of LONGLONG_MAX and LONGLONG_MIN (they are missing the LL
qualifier)

Bogdan Celer <> bogdan@xserwis.com.pl> > wrote:
It’s a little program test.cc

#include <sys/neutrino.h
#include <inttypes.h
#include <stdio.h
main( void )
{
long long res;
printf( “LONGLONG_MIN = %lld\n”, LONGLONG_MIN );
res = LONGLONG_MIN;
printf( “res = %lld\n”, res );
printf( “LONGLONG_MAX = %lld\n”, LONGLONG_MAX );
res = LONGLONG_MAX;
printf( “res = %lld\n”, res );
}

When I compiling it under QNX 6.2 :
gcc -otest_c test.c all working OK
and ./test_c

LONGLONG_MIN = -9223372036854775808
res = -9223372036854775808
LONGLONG_MAX = 9223372036854775807
res = 9223372036854775807

When rename test.c to test.cc and try
gcc -otest_cc test.cc
test.cc: In function int main()': test.cc:8: integer constant out of range test.cc:8: warning: decimal integer constant is so large that it is unsigned test.cc:9: integer constant out of range test.cc:9: warning: decimal integer constant is so large that it is unsigned test.cc:11: integer constant out of range test.cc:11: warning: decimal integer constant is so large that it is unsigned test.cc:12: integer constant out of range test.cc:12: warning: decimal integer constant is so large that it is unsigned and gcc not make programm test_cc. When I try gcc -pedantic -otest_cc test.cc test.cc:6: warning: ANSI C++ forbids declaration main’ with no type
test.cc: In function int main()': test.cc:7: warning: ANSI C++ does not support long long’
test.cc:8: warning: integer constant out of range
test.cc:8: warning: decimal integer constant is so large that it is
unsigned
test.cc:9: warning: integer constant out of range
test.cc:9: warning: decimal integer constant is so large that it is
unsigned
test.cc:11: warning: integer constant out of range
test.cc:11: warning: decimal integer constant is so large that it is
unsigned
test.cc:12: warning: integer constant out of range
test.cc:12: warning: decimal integer constant is so large that it is
unsigned

gcc make test_cc but
./test_cc
LONGLONG_MIN = 577732285961338880
res = 0
LONGLONG_MAX = 4294967295
res = 9223372036854775807
Under QNX 6.1 all makes wery well test_c and test_cc - no warning no
erros. test_cc i do withaout -pedantic
Why under QNX 6.2 it not working ?
Best Regards,

Bogdan


\

cburgess@qnx.com


QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:a5llhd$l3p$1@nntp.qnx.com

Kris Warkentin <> kewarken@qnx.com> > wrote:
I noticed this too…what the heck is that INT_BITS define? The
only
difference if it’s == 64 is the LL suffix. Weird.

My guess – its defining the number of bits in a native “int” for that
platform, 16, 32, 64.

That would be the logical guess, it’s just that the result of it being
defined as 64 is strange. The only difference is whether or not we put an
LL after the number.

-David


Kris
“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:a5jlkf$731$> 1@nntp.qnx.com> …
Thanks, there’s a problem in limits.h with the definition
of LONGLONG_MAX and LONGLONG_MIN (they are missing the LL
qualifier)

Bogdan Celer <> bogdan@xserwis.com.pl> > wrote:
It’s a little program test.cc

#include <sys/neutrino.h
#include <inttypes.h
#include <stdio.h
main( void )
{
long long res;
printf( “LONGLONG_MIN = %lld\n”, LONGLONG_MIN );
res = LONGLONG_MIN;
printf( “res = %lld\n”, res );
printf( “LONGLONG_MAX = %lld\n”, LONGLONG_MAX );
res = LONGLONG_MAX;
printf( “res = %lld\n”, res );
}

When I compiling it under QNX 6.2 :
gcc -otest_c test.c all working OK
and ./test_c

LONGLONG_MIN = -9223372036854775808
res = -9223372036854775808
LONGLONG_MAX = 9223372036854775807
res = 9223372036854775807

When rename test.c to test.cc and try
gcc -otest_cc test.cc
test.cc: In function int main()': test.cc:8: integer constant out of range test.cc:8: warning: decimal integer constant is so large that it is unsigned test.cc:9: integer constant out of range test.cc:9: warning: decimal integer constant is so large that it is unsigned test.cc:11: integer constant out of range test.cc:11: warning: decimal integer constant is so large that it is unsigned test.cc:12: integer constant out of range test.cc:12: warning: decimal integer constant is so large that it is unsigned and gcc not make programm test_cc. When I try gcc -pedantic -otest_cc test.cc test.cc:6: warning: ANSI C++ forbids declaration main’ with no type
test.cc: In function int main()': test.cc:7: warning: ANSI C++ does not support long long’
test.cc:8: warning: integer constant out of range
test.cc:8: warning: decimal integer constant is so large that it is
unsigned
test.cc:9: warning: integer constant out of range
test.cc:9: warning: decimal integer constant is so large that it is
unsigned
test.cc:11: warning: integer constant out of range
test.cc:11: warning: decimal integer constant is so large that it is
unsigned
test.cc:12: warning: integer constant out of range
test.cc:12: warning: decimal integer constant is so large that it is
unsigned

gcc make test_cc but
./test_cc
LONGLONG_MIN = 577732285961338880
res = 0
LONGLONG_MAX = 4294967295
res = 9223372036854775807
Under QNX 6.1 all makes wery well test_c and test_cc - no warning no
erros. test_cc i do withaout -pedantic
Why under QNX 6.2 it not working ?
Best Regards,

Bogdan


\

cburgess@qnx.com


\

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Thank you Colin,
I change a limits.h and all works very well.

Colin Burgess wrote:

Thanks, there’s a problem in limits.h with the definition
of LONGLONG_MAX and LONGLONG_MIN (they are missing the LL
qualifier)