Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/arch/next68k/next68k
Date: Thu, 15 Jan 2009 22:40:54 -0700 (MST)
From: "M. Warner Losh" <imp%bsdimp.com@localhost>
Message-ID: <20090115.224054.129864788.imp%bsdimp.com@localhost>
| In message: <20090112075756.051D0175D0%cvs.netbsd.org@localhost>
| Christoph Egger <cegger%NetBSD.org@localhost> writes:
| : use PRIx64 format to printf type dev_t
|
| I'm surprised that there wasn't a PRI_dev_t defined for this (or some
| variation on that theme)...
Absolutely.
I'd suggest that every _t type defined (anywhere in the basic system
anyway) should have a PRI macro defined along with it (the sole exception
being types that it is impossible to print with any simple format - structs
and such).
I've been meaning to suggest this as a policy for some time now - originally
I was planning on exempting the [u]intNN_t types, but even those I believe
should have PRI macros.
After all, who can tell what format string is supposed to be used on
various different systems for a int32_t - it's probably %d on most
systems today, but on a 16 bit int system (and yes, I know, not supported
by NetBSD) it would need to be %ld, and perhaps more likely, if we ever
get a 64 bit int system, it might need to be %hd or something.
Only variables of type "int" should be printed %d only type long int %ld
(etc) - anything declared with a _t manufactured type should be printed
using a defined for the type PRI macro (ie: one associated with the
specific type used, no sharing of PRI macros for more than one _t type, ever.)
Once all the PRI* macros are in place, all code everywhere should be
(gradually, as it is touched for other reasons) updated to always use
the macros for printing (ie: please avoid rampages of changing code
for no other reason than this, but when code needs to be changed anyway,
fix this as well).
kre
Home |
Main Index |
Thread Index |
Old Index