Re: printk and long long

From: wdebruij
Date: Wed Feb 11 2004 - 09:16:40 EST


Quoting Måns Rullgård <mru@xxxxxx>:

>
> And how do you plan to make sense of the printed value?
>

perhaps I was a bit quick with replying. As others have pointed out, you should
specify the precision to be able to glue the two parts together. Ideally, this
should be done using a "%.8lx%.8lx", since the length of the variable in hex is
static. Unfortunately, it seems %ld is requested, in which case "%ld*(2^32)+%ld"
works (for humans), but is obviously not great.

I guess you'll need a number of extra tests (if lower 32bits > 1 billion ..) and
specific printk statements if the output should be shown as a correct 10-base
number.

I don't know, it depends on the specific use-case, really. If at all possible, I
would stick to the hex-representation.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/