gpt4 book ai didi

c++11 - C++ 11 uint类型与u_int

转载 作者:行者123 更新时间:2023-12-03 17:44:11 25 4
gpt4 key购买 nike

我只是偶然发现了u_int8_t类型,因为它不能在Windows + MinGW中编译(但是在Linux下可以很好地编译)。根据this site,C++ 11标准定义了uint8_t类型。我只是使用了后者,所以一切正常。

出现的问题是:

  • u_int8_tuint8_t之间有什么区别?
  • 是否有理由(除了旧版代码外)使用u_int8_t
  • 如果我使用C++ 11编译器(在不同的OS或体系结构上),可以安全地假设uint8_t存在吗?
  • 以上问题的答案是否对其他类型(intX_tuintX_t)也有效?
  • 最佳答案

    Is there any difference between u_int8_t and uint8_t?


    u_int8_t只是一个非常老的名称,尚未标准化。躲开它。

    Is there a reason (besides legacy code) to use u_int8_t?



    同事自杀。

    Is it safe to assume that uint8_t will be present if I use a C++11 compiler (on different OS or architectures)?



    C++标准要求它存在于所有可用的无符号8位类型的实现中(今天这意味着所有非奇特的东西)。

    Are the answers to the above questions also valid for the other types (intX_t and uintX_t)?



    是的,是的。

    关于c++11 - C++ 11 uint类型与u_int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23291323/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com