[fitsbits] Blank strings in FITS keywords.
LC's No-Spam Newsreading account
nospam at mi.iasf.cnr.it
Wed Mar 2 04:39:01 EST 2005
On Tue, 1 Mar 2005, Maren Purves wrote:
> I think that's an entirely different question. Some of our older
> data reduction software takes offense to character strings containing
> nulls, but I consider that beside the point here as well.
>
> I thought the question was whether '' _is_ a null string or a blank
> string and I also think that '' should be a null string, independent
> of whether we (can) write it or read it, not blank.
Personally I've always been disturbed by the distinction between a null
string, a single blank character, an entirely blank string, or a
non-existing value, which I consider a useless nuisance.
I've always written my s/w to deal with such cases in equivalent ways,
making the distinction irrelevant. That applies both to reading FITS
header keywords, or to getting the value of environment variables, or
whatever else. In all such cases I use calls of the form
GET_xxx_VALUE(name,value,defaultvalue,error)
This will return to me the "value" of the object (keyword, environment
variable) named "name", but, if it does not exist, is not set, is null
or entirely blank, will return the "defaultvalue" I supply as "value".
This can be a true default useful in the specific situation, or some
placeholder like 'undefined' or 'notexisting'.
An error code "error" might be useful to flag (as warning) the fact the
default value was substituded to the returned value, as well as other
conditions (e.g. a string was truncated, a type mismatch etc.)
Lucio Chiappetti
--
----------------------------------------------------------------------
nospam at mi.iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.
More information about the fitsbits
mailing list