|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2007-08-13 18:52:28
LOL - well it IS surprising.
Take a look at the documentation for the class serialization trait
"Implementation Level".
This touches upon a really big issue with a library such as this. Question
is
which do you do:
a) always the right thing
b) always the same thing - and maybe emit a warning or error when its not a
good idea
Choosing b) makes for a transparent system and this is what I usually
prefer.
Generally I detest hidden features, attributes, which make things look
easier but in fact produce
surprising side-effects. When tthings fail it means a huge effort trying to
get
to the bottom of things - often the only recourse is by trial and error.
a) is much more popular today. It seems easier and makes a better demo.
And its seductive - let's design it so "it just works". If there is one
program
in my whole life which has tested my sanity its Microsoft Word. (next in
line might be bjam).
In practice I usually prefer b) but sometimes - like this one - I give
myself a
pass and slip into a). In this case it was deliberate design decision to
"do
what the user probably wants if he doesn't otherwise specify it". In spite
of my prejudice generally against this kind of thing, I think in this case
it
has worked to advantage as I have gotten very few complaints and
problems about it.
There might be a few other places where something similar has been done -
but these
would also be exeptional cases.
So I sympathize with your point of view in general, I just don't think
its the correct one in this particular case.
Of course, if one is going to do something like run 1 TB through the
serializer, he really should carefully read the manual, and carefully
consider what he's doing. I wouldn't trust me to have done the right thing
.
Robert Ramey
gast128 wrote:
> Thx for the answer. My point is that if you nowhere specify a
> load/store through pointer, the following code stores just multiple
> copies:
>
> for (int i = 0; i < 100; ++i)
> {
> const SomeStruct s;
> oa << s;
> }
>
> but this behavior seems to change if somewhere a store through is
> performed. This was for my surprising.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net