简体   繁体   中英

Should I use C types (uint8_t/…/uint64_t) or (u_int8_t/…/u_int64_t)?

My GNU-Linux platform (debian stretch) has the C types u_int8_t , u_int16_t , u_int32_t and u_int64_t defined in the file sys/types.h while uint8_t , uint16_t , uint32_t and uint64_t are defined in stdint.h . I have found these types useful in the course of practicing X86-64 assembly language and interacting with C. Is there any reason why I should prefer one header file over the other (be it 'best practice', portability etc.)?. Is the answer any different for C++?

stdint.h is standard C, which maps to cstdint in standard C++.

sys/types.h is not portable C.

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