Home

On Sep 17, 4:23 pm, Michael DOUBEZ <michael.dou...@free.fr> wrote:
> cppques...@googlemail.com a écrit :
>
> > I got an app where a bunch of values are set before the calculation is
> > fired up.
>
> > I need an elegant way to check if all variables have been set.
> > So for example for double I am thinking
>
> > Apart from that: Into which trouble am I running?
> > As I am probably not the first to think about this basic issue,
> > is there already an implemtation for the basic POD available?
>
> An old method is to use dead value if available (nan for float, max for
> int) at initialization and then assert them:
> See
> std::numeric_limits<>::quiet_NaN() or std::numeric_limits<>::infinity().
> std::numeric_limits<>::max().
>
> Michael

I thought about this as well. It might be feasible but at least for
ints
it is rather unelegant, if all values might be valid (lets say at
least all
integral parameters together might very well cover the full range).
And for double or float NaN might be the result of some calculation as
well
(or can this never be quiet_NaN(), i.e. is quiet_NaN() especially made
for such a case ?)

However, I might fall back to this solution if it turns out that the
flagged
values (class Double) do have some drawbacks.

previous
next

Re: calling a .net application from Python 2.5
Re: Another question about variable args.
Re: Reading code from a file
Re: difference between libboost_regex-mt-gd-1_33_1.lib and boost_regex-mt-gd-1_33_1.lib
Re: convert char * to char []
Fundacja Hobbit
Akogo
Mam Marzenie
Niechciane i Zapomniane
Fundacja Sloneczko