$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] unsigned long vs unsigned int vs std::size_t (32b platform)
From: Christoph Mathys (eraserix_at_[hidden])
Date: 2009-09-20 14:52:46
Thomas Suckow wrote:
> Christoph Mathys wrote:
>> void someFunc(boost::uint16_t) { }
>> void someFunc(boost::uint32_t) { }
>> void someFunc(std::size_t) { }
>>
>>
> Not sure if you are optimizing for 16bit and 32bit.
It is actually code handling some endianness stuff.
> Wouldn't a template function be appropriate here?
Maybe a template function would be more appropriate, avoiding possibly
dangerous conversions by putting a static assert into the default
implementation. But I'd still have to provide specializations for
uint32_t and unsigned long or uint32_t and unsigned int, depending on
the platform.
Ideally, I'd like to work only with those fixed width integers if I need
to provide an implementation for every integer type, avoiding code noise
with ifdef and co.
Christoph