Subject: Re: printf formats again
To: None <current-users@NetBSD.ORG>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 11/18/1996 17:38:32
[ On Sun, November 17, 1996 at 17:09:13 (-0800), Don Lewis wrote: ]
> Subject: Re: printf formats again
>
> But this only works if the arguments aren't composite types.  If
> you wanted to have a 64 bit off_t but didn't have compiler support
> for any 64 bit integral types, you'd be out of luck.  For instance
> if long was only 32 bits and integral types larger than long were't
> allowed ...

Well, most code I've written using off_t would break in that case
(eg. if off_t were defined as an array of 2 longs or something equally
nasty), since the compiler wouldn't likely be too happy to use such a
type in an average arithmetic expression.

However assuming your compiler did allow you to have such an off_t
represent the result of an expression, then presumably it would pass
this result as one parameter in a function all, and in that case your
printf() implementation would easily be able to pull off the right
number of octets from the parameters as specified by sizeof(off_t) and
try to do some form of conversion in an attempt to give a user-parsable
representation of the value.

This is were a more 'oop' style would help greatly (i.e. write "print"
functions returning char* for some printable representation of each type
and just use "%s" for printf).

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>