Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jan 2003 18:00:04 +0100 (CET)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        hackers@freebsd.org
Subject:   printing of uint64_t in the kernel
Message-ID:  <20030103175514.H901-100000@beagle.fokus.gmd.de>

next in thread | raw e-mail | index | archive | help

Hi,

while porting the NgATM stuff to sparc64 I could not answer the following
question: What is the correct way to printf() an uint64_t in the kernel.
For i386 I need %llu, for sparc64 I need %lu or gcc will give a warning.
I see two variants:

1. include <inttypes.h> or <machine/_inttypes.h> and use the
standard printf format strings.

2. cast always to uintmax_t and use %ju.

The first possibilities seems wrong, because one should not include a
non-system header, the second because given a (hypothetical) machine with
128-bit uintmax_t this would incure a useless overhead. So what?

harti
-- 
harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
              brandt@fokus.gmd.de, brandt@fokus.fhg.de


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030103175514.H901-100000>