<source>: In function 'main':
<source>:7:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'uint64_t' {aka 'long unsigned int'} [-Wformat=]
7 | printf("%llu\n", integer);
| ~~~^ ~~~~~~~
| | |
| | uint64_t {aka long unsigned int}
| long long unsigned int
| %lu
Compiler returned: 0
1. 네, 보시다시피 uint64_t는 longlongunsignedint가 아니라 longunsignedint 라는군요.
2. 현재 환경에서는 셋 다 8바이트이지만, 다른 환경에서는 그렇지 않을 수 있겠지요.
3. 이식성 있는 코드를 원하십니까?
#include <stdio.h>
컴파일러는 x86_64 gcc 12.2, 옵션은
-std=c11 -Wall -pedantic -pedantic-errors -O3
결과는...
1. 네, 보시다시피
uint64_t
는long long unsigned int
가 아니라long unsigned int
라는군요.2. 현재 환경에서는 셋 다 8바이트이지만, 다른 환경에서는 그렇지 않을 수 있겠지요.
3. 이식성 있는 코드를 원하십니까?
감사합니다.
..
댓글 달기