Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-11-10 10:21:59


Michael Shepanski wrote:
> Hello again. I'd like to reawaken this thread because It didn't seem
> to
> reach a conclusion, and the bug that started it continues to cause me
> pain.
>
>
> On 10/29/05, Fernando Cacciola <fernando_cacciola_at_[hidden]> wrote:
>>
>>
>> As Martin Bonner suggested, one solution is to factorize the result
>> of alignment_of<> so it returns not just any multiple.
>> Unfortunately, we
>> can't
>> say that the alignment _ought_ to be a power of 2 can we?
>>
>> An alternative solution that, at least, would work with this very
>> specific example, is to compute it as the minimun of
>> sizeof(charT)-sizeof(T) and sizeof(Tchar)-sizeof(T)
>> That is, adding the char both before and after, and taking the least
>> difference.
>
> These both sound like interesting solutions; what do others think?
> Are they theoretically correct?
>
> A policy question: what happens if no theoretically correct solution
> is found? Would boost::optional then be discontinued? Or would
> it be reimplemented in a way that happens to work on all popular
> platforms? Or would it switch at compile-time between overtly
> platform-specific implementations?
>
> I do hope that the policy is not to keep the current solution until a
> theoretically correct solution is comes to light. Not to put too fine
> a
> point on it, the current solution is theoretically incorrect too; the
> only thing that distinguishes it from other theoretically incorrect
> solutions
> that have been discussed is that this one fails in practice.
>
And FWIW my solution works in practice.. specifically in your case, which is
the first and only case reported so far.
So if I where you, I would just implement it into your version of the code..
(If you don't know how let me know and I'll do it)

HTH

-- 
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com/ 

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