Boost logo

Boost :

Subject: Re: [boost] boost/pool/pool.hpp why reinterpret_cast instead ofstatic_cast?
From: Joseph Gauterin (joseph.gauterin_at_[hidden])
Date: 2009-03-13 09:22:56


It's my understanding that static_casting the result of malloc is well
defined behaviour, whereas using reinterpret_cast isn't.

>Casting from void* to T* (or X* to Y*) is precisely when I'd use
>reinterpret_cast (and, indeed, it's not much use for anything else).

Because the result of a reinterpret_cast is implementation defined,
it's only really useful when writing code that has implementation
defined results by neccessity (endian handling code for example).


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