Sziasztok!
Adott a köv. kis program, aminek 32 és 64 biten is jól kéne működnie:
#include <stdio.h>
#include <sys/types.h>
#include <inttypes.h>
int main()
{
int64_t tmp;
scanf("%" SCNd64, &tmp);
printf("%" PRId64 "\n", tmp);
return 0;
}
gcc -vel (gcc version 4.7.2 (Debian 4.7.2-5)) simán lefordul, g++ -al
(ugyan az a verzió) nem (Debian wheezy frissítve):
s.c: In function ‘int main()’:
s.c:8:15: error: expected ‘)’ before ‘SCNd64’
s.c:9:16: error: expected ‘)’ before ‘PRId64’
A fenti progi cpp után így néz ki:
...
int main()
{
int64_t tmp;
scanf("%" "l" "d", &tmp);
printf("%" "l" "d" "\n", tmp);
# 40 "s.c"
return 0;
}
Ha ennek az elejére beteszem az #include <stdio.h> -t és <sys/types.h>,
akkor lefordul g++ -al is!
Mit nézek el?
Előre is köszi,
--
Üdv:
Salamon Attila
_________________________________________________
linux lista - [email protected]
http://mlf.linux.rulez.org/mailman/listinfo/linux