Difference between different integer types

后端 未结 4 2156
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 15:37

I was wondering what is the difference between uint32_t and uint32, and when I looked in the header files it had this:

types.h:

           


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 15:47

    unsigned and unsigned int are synonymous for historical reasons; they both mean "unsigned integer of the most natural size for the CPU architecture/platform", which is often (but by no means always) 32 bits on modern platforms.

    is a standard header in C99 that is supposed to give type definitions for integers of particular sizes, with the uint32_t naming convention.

    The that you're looking at appears to be non-standard and presumably belongs to some framework your project is using. Its uint32 typedef is compatible with uint32_t. Whether you should use one or the other in your code is a question for your manager.

提交回复
热议问题