Boost logo

Boost :

Subject: [boost] [Config] boost::uint32_t != std::uint32_t on some targets
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-11-22 12:24:33


Dear Boost,

I recently fell into a trap where a program wouldn't compile because of a
difference between `boost::uint32_t` and `std::uint32_t`. Specifically, I
was trying to cross-compile from OS X to ARM, and the following program
wouldn't compile

    #include <boost/cstdint.hpp>
    #include <cstdint>
    #include <type_traits>

    static_assert(std::is_same<std::uint32_t, boost::uint32_t>::value, "");

    int main() { }

I was building with

    arm-none-eabi-g++ -I /path/to/boost -std=c++11 -c main.cpp

I have asked a question on StackOverflow [1], and I now understand why the
two types are not required to be the same. However, I think it is a QOI
issue that those two types are not the same, since it makes interoperating
between `std::uint32_t` and `boost::uin32_t` more difficult. Is there a
reason for this difference, and if not would it be reasonable to ensure that
`boost::uint32_t == std::uint32_t` whenever the latter is defined, i.e. in
C++11 and above?

Regards,
Louis

[1]: http://stackoverflow.com/q/33857554/627587


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk