gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: altitude validity


From: Greg Troxel
Subject: Re: altitude validity
Date: Tue, 04 Feb 2020 19:23:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix)

"Gary E. Miller" <address@hidden> writes:

>> So this notion of NaN makes a lot of sense, but it was unobvious from
>> reading gps.h and from reading the libgps man page.
>
> No one gets NaN the first few times.  Libraries constantly get it wrong.
> I have seen sevaral bug reports on major languages in the last week
> about NaN misunderstanding.

It's not that I don't understand NaN.  It's that there is a field, with
comments about when it's valid.  So if it's supposed to be valid, it has
to contain a number that is right-ish.  And if it's not supposed to be
valid, one shouldn't even look at it.

The notion that the field is either NaN or valid is a reasonable one,
but it is not the default assumption for an interface.  If the comment
said "This is either NaN, signifying that the field is not valid, or
else contains a valid value." that would be fine.  But it does not make
senes to expect people to guess that, especially when the comments hint
hotherwise.

>> I am also unclear on that ALTITUDE_SET means, if one is supposed to
>> check against NaN.
>
> It means nothing.  Note that is it undocumented.  Ignore it.  I would
> remove it, but there is so much legacy code that all I can do is
> deprecate it.

That really calls out for a comment in the header.    People should be
able to read the .h (or something) and understand the interface.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]