[Nagiosplug-devel] check_icmp min and max
Andreas Ericsson
ae at op5.se
Thu Oct 30 11:15:50 CET 2008
Thomas Guyot-Sionnest wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 29/10/08 07:59 AM, Andreas Ericsson wrote:
>> Thomas Guyot-Sionnest wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> On 28/10/08 03:02 PM, Andreas Ericsson wrote:
>>>> rader at hep.wisc.edu wrote:
>>>>> Sure. (I used MAXDOUBLE, da.) Shall I ask a
>>>>> Physicist how far across the Universe that'd get us??
>>>>>
>>>> No need. It's about as far as Marvin walks in the hitchhiker trilogy ;-)
>>>>
>>>> Thanks for the resend.
>>> Do you have commit access or shall I do it for you?
>>>
>>> And out of curiosity, why not using DBL_MAX instead of defining a new
>>> value?
>>>
>> DBL_MAX isn't always defined. Think broken header files here.
>> otoh, defining DBL_MAX to something suitably huge if it isn't
>> defined would get the best of both worlds.
>>
>
> That's what I first though, but gnulib defines LDBL_MAX on some systems
> where it's missing, but not DBL_MAX, so my guess was that's it's always
> there. Anyways it never hurts to check for that though.
>
> So what about something like that:
>
> @@ -106,6 +106,7 @@
> # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
> #endif
>
> +#ifdef DBL_MAX
> +# define RTMIN_MAGIC_CONSTANT DBL_MAX
> +#else
> +# define RTMIN_MAGIC_CONSTANT 9.999999999999999e999
> +#endif
>
> typedef unsigned short range_t; /* type for get_range() --
> unimplemented */
>
> @@ -120,6 +121,8 @@
>
>
> Shall I commit his patch for you??
>
Sure. An even better one would probably be
#ifndef DBL_MAX
# define DBL_MAX 9.9999999999e999
#endif
and then just using DBL_MAX instead of RTMIN_MAGIC_CONSTANT, but I
have no strong preference either way.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
More information about the Devel
mailing list