[GRASS5] How to code NULL in sites lists?

Eric G . Miller egm2 at jps.net
Wed Oct 11 21:30:48 EDT 2000


On Wed, Oct 11, 2000 at 06:36:01PM +0100, Markus Neteler wrote:
<snip>
> Maybe we should allow two values:
> 
> -9999 (for all data coming from ESRI world)
> NAN  (but this is a strings?!)

I should clarify.  NAN is used for floating point (double) variables
while resident in memory. Then:

	if (isnan(my_double)) { /* It's NULL */ }
	else {  /* do work */ }

For strings:
	if (string[0] == '\0') { /* Empty string */ }

    or 
    	if (strlen(string) == 0) { /* Again */ }

Granted, in some contexts an empty string is not the same thing as a
NULL value, but I think it'll be easier to code around rather than
library functions returning a NULL pointer for a string attribute.  I
don't know...

As far as the ESRI sentinel value -9999, it's an integer.  I don't know
if they use such a thing for their floating point grids.  I don't see
any reason to carry this around in the site file.  Import or conversion
routines might want to look for it and do an appropriate translation.
I'm not sure where this fits in in relation to sites...

I think this change in behavior should be postponed to GRASS 5.1.  I
suspect it will cause lots of code breakage (maybe I'm wrong?).  It
depends how important people think this is.  It's hovering around the
middle in my mind.

-- 
/bin/sh ~/.signature:
Command not found

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list