QNX6.3SP2 compiler bug (uint64_t variable usage)?

I’ve discovered a “funny” issue with using an uint64_t variable.

The program:

#include #include #include

int main (int argc, char *argv[]) {
uint64_t ll;

ll = 20060430191242369LL; // timestamp: date time with millis
printf(“1) ll=%lld\n”, ll);
ll = 00000030000000000LL; // timestamp: number of days
printf(“2) ll=%lld\n”, ll);
ll = 030000000000LL; // timestamp: number of days
printf(“3) ll=%lld\n”, ll);
ll = 30000000000LL; // timestamp: number of days
printf(“4) ll=%lld\n”, ll);


The result:

1) ll=20060430191242369 2) ll=3221225472 3) ll=3221225472 4) ll=30000000000

You see?

One or more leading zeroes messes things up (line 2 & 3 I would expect to be identical to line 4).

Am I wrong or is this a compiler issue?

Jacob Dall

The leading 0 turn the number into octal.

  • Mario

Hello Mario,

Octal?? - should have thought of that one - I guess I forget stuff I never use.