[Dnsmasq-discuss] Patch: Add --ping-timeout option
matthias.andree at gmx.de
Wed May 16 22:49:42 BST 2012
Am 16.05.2012 22:02, schrieb aopfer at bennett-electric.com:
>> 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
> 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.
Indeed - if the compiler is standards compliant, it will type promote
the right-hand side of the entire assignment to double anyways.
More information about the Dnsmasq-discuss