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

前端 未结 6 1666
情歌与酒
情歌与酒 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:02

    Personally I prefer boost::int8_t and boost::uint8_t.

    If you don't want to use boost you could borrow boost\cstdint.hpp.

    Another option is to use portable version of stdint.h (link from this answer).

提交回复
热议问题