Re: [dev] Re: [slstatus] temperature module acts wierd on OpenBSD

From: Laslo Hunhold <dev_AT_frign.de>
Date: Tue, 16 Jun 2020 23:24:26 +0200

On Tue, 16 Jun 2020 20:53:34 +0200
Mattias Andrée <maandree_AT_kth.se> wrote:

Dear Mattias,

> I'm assuming temp.value i an `int`, as %d is used. The problem was
> probably that `1E6` is actually a `double` rather than an `int`,
> as the whole expression is promoted to `double`, because `bprintf` is
> (I assume) variadic, and the compiler does not know to change the
> cast the expression back to `int` because only the type of the first
> argument is specified in its declaration.

ah yes, of course! Thanks for pointing that out. It's never a good idea
to work with floats when you end up casting to int in a step inbetween
or after. Let's go with the FreeBSD-approach seen below that code.

With best regards

Laslo
Received on Tue Jun 16 2020 - 23:24:26 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 16 2020 - 23:36:08 CEST