[Dnsmasq-discuss] Patch: Add --ping-timeout option

aopfer at bennett-electric.com aopfer at bennett-electric.com
Wed May 16 21:02:40 BST 2012


> What is the purpose of casting stuff to float type explicitly (see
> quoted part below)?
>
> difftime() returns double, so the comparison arguments will be
> type-promoted to "double" anyways, no matter if you provide float, or
> integer. (This applies equally to the original code, not just the new
> code.)

You might be right about the existing code doing a conversion
needlessly.  My code was just following the previous example. It's a
one-character fix; just remove the "f" from "1000.0f" and it's a
double. (Of course, removing the ".0" as well would demote that
expression to an int, causing loss of data, and we don't want that.)

I bet the compiler fixes it up anyway.

> Regarding the option numbering in src/option.c, I'd propose to go with
> enum rather than #define. Doing so exposes the symbols in debuggers.

And it eliminates the possibility of making two symbols with the same
value from human error, even if the possibility of human error is very
slim.

Aaron Opfer




More information about the Dnsmasq-discuss mailing list