简体   繁体   中英

-ansi -pedantic 64 bits length integers in C

I would like to know if there is an equivalent to int64_t in C that would work on 32 and 64 bits platforms and that is ansi and pedantic gcc modes compliant.

I found this interesting post , but it relates on C++.

I tried to used long long but i get an integer overflow in expression [-WOverflow] error. Moreover long long is not supported by ISO C90.

I also tried what is suggested in this post , but i still have a -WOverflow error with using int64_t

Any solutions ?

  • In C89 (required by -ansi flag), there is no standard way to use a 64 bits integer. You have to rely on the types provided by your implementation.

  • In C99, some implementations may define int64_t , since it is an optional type. As for long long (C99), there is no guarantee that its width is exactly of 64 bits.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM