Subject: Re: SMP API things, lock debugging, etc.
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-smp
Date: 07/27/1999 09:49:55
Jason Thorpe <thorpej@nas.nasa.gov> writes:
> Some people have suggested that a data type `cpuid_t' be introduced to
> hold CPU identifiers.  After some consideration, I have concluded that
> the type `unsigned long' is preferable for the following reasons:
> 
> 	Machine-independent code may wish to print out the value of
> 	a CPU identifier.  Therefore a type with a well-defined printf
> 	format should be used.
> 
> 	The `unsigned long' type is the size of a register on all current
> 	ILP32 and LP64 platforms supported by NetBSD.  Therefore, this
> 	type is safe to use for this purpose on all platforms.

C9x provides a perfectly reasonable convention for this type of thing,
which will work fine and assumes only c89-style string concatenation.

I'm not saying that 'unsigned long' isn't a reasonable choice, but it
seems that a type would be better programming practice, and the printf
format issue is really a non-issue (since there's a decent way to
solve it).

Of course, "a decent way to solve it" assumes c89 string
concatenation, but then maybe i'm now showing my bias that i think
it's STUPID that we're still writing K&R c in new code when c89 has
been around for 10 years and the portaibility limitations its use
would imply pale in comparison to some of the issues around use of
gcc.  8-)



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.