What's the C++ equivalent of UINT32_MAX?

前端 未结 5 1744
广开言路
广开言路 2021-02-02 07:27

In C99, I include stdint.h and that gives me UINT32_MAX as well as uint32_t data type. However, in C++ the UINT32_MAX gets d

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 07:40

    You may be able to eliminate the #include order problems by changing your build process to define the __STDC_LIMIT_MACROS symbol on the compiler command line instead:

    cxx -D__STDC_LIMIT_MACROS ...
    

    Of course, you would still have trouble if a header #undefs this symbol.

    Also, the authors of the standard library implementation that you are using might not have intended for users to set that particular symbol; there might be a compiler flag or a different symbol that users are intended to use to enable C99 types in C++.

提交回复
热议问题