Boost logo

Boost :

From: Marcus Lindblom (macke_at_[hidden])
Date: 2006-09-18 08:13:03


Damien Fisher wrote:
> On 9/18/06, Robert Ramey <ramey_at_[hidden]> wrote:
>
>> Note that the only reason for using __declspec on tis platform is
>> that without it, programs compiled in release mode will optimize
>> away code not explicitly referred to. This breaks serialization
>> of derived pointers. So this is a hack to work around over-zealous
>> compiler optimizaton. This has been learned through painful and
>> time consuming experience. It is possible this solution is overkill
>> in some cases, but there is no way to know without investing
>> a lot more effort.
>>
>
> If you have the time, could you explain to me exactly what the problem
> is (or show me a program highlighting the problem)? How can the code
> be needed for serialization if it isn't actually "used" from the
> compiler's point of view?
A quite common problem when dealing with factories and such things.
'Niftycounters' can be used to counter this, i.e. forcing code in a cpp
to be referenced by including it's header.

How this applies to serialization is a matter unbeknowns to me though. :)

/Marcus


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