What does a type followed by _t (underscore-t) represent?

后端 未结 10 696
萌比男神i
萌比男神i 2020-11-22 07:15

This seems like a simple question, but I can\'t find it with the Stack Overflow search or Google. What does a type followed by a _t mean? Such as



        
10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 07:49

    There were a few good explanations about the subject. Just to add another reason for re-defining the types:

    In many embedded projects, all types are redefined to correctly state the given sizing to the types and to improve portability across different platforms (i.e hardware types compilers).

    Another reason will be to make your code portable across different OSs and to avoid collisions with existing types in the OS that you are integrating in your code. For this, usually a unique (as possible) prefix is added.

    Example:

    typedef unsigned long dc_uint32_t;
    

提交回复
热议问题