Best Practices: Should I create a typedef for byte in C or C++?

前端 未结 6 1800
情歌与酒
情歌与酒 2021-02-07 05:40

Do you prefer to see something like t_byte* (with typedef unsigned char t_byte) or unsigned char* in code?

I\'m leaning towards

6条回答
  •  眼角桃花
    2021-02-07 06:07

    Besides your awkward naming convention, I think that might be okay. Keep in mind boost does this for you, to help with cross-platform-ability:

    #include 
    
    typedef boost::uint8_t byte_t;
    

    Note that usually type's are suffixed with _t, as in byte_t.

提交回复
热议问题