Subject: Re: types gone amuck (Re: CVS commit: basesrc/bin/pax)
To: Klaus Klein <kleink@reziprozitaet.de>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 10/28/2001 08:10:36
so is "u_longlong_t" actually an ANSI-specified type?
if not, we should remove the comment that says that it is.
if it's supposed to be defined as "unsigned long long",
then we should change the header so that it is.
actually if this type isn't specified by any standard,
it may be best to just remove it.
-Chuck
On Sat, Oct 27, 2001 at 06:09:57PM +0200, Klaus Klein wrote:
> Chuck Silvers <chuq@chuq.com> writes:
>
> > (void)snprintf(buf, size, "%lu secs (" OFFT_F " bytes/sec)",
> > (unsigned long)tm, (OFFT_T)(sz / tm));
> >
> > where we have:
> >
> > #define OFFT_F "%llu"
> > #define OFFT_T u_longlong_t
> >
> >
> > the reason this is a problem is:
> > /build/destdir/usr/include/sys/types.h:typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
>
> Now that comment is an interesting concept. :-)
>
> > so the way things are right now, we can't assume that "u_longlong_t"
> > is equivalent to "unsigned long long". so the question is:
> > is "u_longlong_t" just supposed to be an unsigned 64-bit type,
> > or is it supposed to be equivalent to "unsigned long long"?
>
> With the principle of least surprise in mind, I believe it is supposed
> to be the latter but was usually used under the assumption of being
> the former.