Boost logo

Boost :

Subject: Re: [boost] boost/pool/pool.hpp why reinterpret_cast instead ofstatic_cast?
From: Niels Dekker - mail address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2009-03-12 09:44:28

Philippe Vaucher wrote:
> In the file
> there's the following code:
> static char * malloc(const size_type bytes)
> {
> return reinterpret_cast<char *>(std::malloc(bytes));
> }
> It is my understanding that void* to T* convertions should be done
> using static_cast and not reinterpret_cast.
> Is there a reason for using reinterpret_cast there?

Good question. I also think it should be static_cast<char*>.

HTH, Niels

Niels Dekker
Scientific programmer at LKEB, Leiden University Medical Center

Boost list run by bdawes at, gregod at, cpdaniel at, john at