|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-10 17:48:18
David Abrahams wrote:
>>
>> * when booleans are output, booleans are converted to integers and
>> an assertion is thrown if the resulting value is other than zero or
>> one.
>
> What do you mean, "an assertion is thrown?" Only exceptions can be
> thrown.
I mean the assert macro is passed a value of false
>> This is in line with my view of trapping a program as soon as
>> possible
>> when any kind of programmign error has been detected.
>
> Some kinds of programming errors aren't worth trying to detect.
> Passing uninitialized data is fundamental brokenness, and looking for
> it with only in bools is rather silly.
Hmm - here I have a situation where I can trap an error commited
when an archive is saved that would not otherwise be detected until
the archive is loaded. The fact I can't trap it for all data types doesn't
mean one should pass the opportunity up for bools. Since its an
assert, it will have no detrimental effect on runtime of release
build code. What is the downside of doing this?
>> This naturally suggests the following for floats and doubles.
>>
>> * any attempt to save floats or doubles for which the result of
>> isnan(..) is false
>> will trap with an assertion.
> So, you're going to assert whenever someone tries to save a non-NaN?
> That sounds pretty useless. Even if you meant the opposite,
LOL - of course I meant the opposite.
> it would be an unfortunate choice. Non-signalling NaNs should be
> serializable.
Hmm - that sounds like a matter of opinion to me.
>> This would be a good thing from my standpoint as up until now a NaN
>> could be saved but not recovered as the standard text stream input
>> chokes on the Nan Text.
>
> Seems like you should work around that problem.
If it indeed it is a problem.
>> Meanwhile the binary input just loads the bits whatever they were.
>> This conclicts with my goal of making all archives behave alike.
> ...
>> I'm concerned that someone standup and show "But NaN is a valid value
>> for a float or double and I should be able to serialize that!!!".
>
> Damn straight.
>> I'm inclined to reject this characterisation basically because doing
>> so will make my life easier. This will trap some user's errors at
>> the cost of prohibiting some behavior that could be defended as
>> correct.
What I'm curious about is what is the utility of serializing a NaN?
Why would someone want to do this? What does it usually mean?
The only thing that occurs to me is that it would be uninitialized data.
If NaN has been overloaded with some sort of meaning like
"undetermined value" or something like that I would think its a
questionable and error prone practice. If that's the case, I don't
see its a bad thing if the libray fails to support it.
So far only one user has raised the issue of having serialized a NaN
and having it trap on reading back the archive. I don't read a whole
lot into this as this would only occur in text and xml archives and
perhaps others who do this are using binary archives. But it does
suggest that this isn't a huge issue for people actually using the library.
> I find it very distressing that you keep dismissing the needs of the
> numerics community.
I have not done this. And I resent the accusation that I have.
> This is likely to lead to something very
> distasteful, like a semi-official branch of the serialization library
> that works the way we need it to.
Hmm - I can't imagine why anyone would want to do that. Someone
might want to make thier own derivation(s) of one or more archive
classes or even a whole new archive class - but that doesn't
represent any conflict with the current library.
Robert Ramey
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