On Thu, Feb 04, 2010 at 02:50:36AM -0800, Chris Buben wrote: > With your proposed approach, won't we still get invalid json on a > platform where isinf doesn't get defined?
In theory, yes. > This doesn't matter in my particular experience (and never will, as on > RHEL we'll always end up with isinf being defined), but it could be a > gotcha. Well, since infinity isn't handled correctly in the network plugin (among others) I think using it would cause some problems that would need to be fixed first. But you're right, that's no excuse for emitting invalid JSON ;) > Assumption: in system header files, isnan and isinf are defined > together -- so we get either both or neither. So with this > assumption, seems like the only chance of the problem happening is the > scenario when we end up with NAN_ZERO_ZERO (embedded platforms?), and > isnan and isinf aren't defined? I think that's a pretty safe assumption, yes. > +# ifndef isinf > +# define isinf(f) (!isnan (f) && isnan (f - f)) > +# endif /* !defined(isinf) */ Good idea :) I'll split that up into "isfinite" and "isinf" and then use "isfinite" to check for normal, printable floating point values. Best regards, -octo -- Florian octo Forster Hacker in training GnuPG: 0x91523C3D http://verplant.org/
signature.asc
Description: Digital signature
_______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
