Subject: Re: [boost] unsigned long vs unsigned int vs std::size_t (32b platform)
From: Bo Persson (bop_at_[hidden])
Date: 2009-09-17 12:05:10


Christoph Mathys wrote:
> The compilers
> handle 'unsigned int' and 'unsigned long' as different types, even
> though on 32b it is AFAIK the same type.

They are different types, that just happen to be the same size on some
systems.

>
> #include <boost/static_assert.hpp>
> #include <boost/cstdint.hpp>
>
> void someFunc(boost::uint16_t) { }
> void someFunc(boost::uint32_t) { }
> void someFunc(std::size_t) { }
>

Overloading on typedefs are generally not recommended, precisely
because you do not know the underlying types.

Bo Persson