Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2001 15:02:57 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        des@ofug.org
Subject:   Re: "types" man page
Message-ID:  <200110241902.f9OJ2vA46197@khavrinen.lcs.mit.edu>
In-Reply-To: <xzp1yjt0z14.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <xzp1yjt0z14.fsf@flood.ping.uio.no> you write:
>I've been toying with the idea of creating a "types" man page that
>lists common scalar and pointer types in FreeBSD (including standard C
>types).  For every type, the man page would indicate:

Sounds like a useful endeavor.

> - the name (duh)
> - what header(s) (if any) to include to define it
> - width on all supported platforms

Probably a bad idea.  Better to specify the range, rather than the
width, and do it via the appropriate limit constants, so that people
don't make unfortunate assumptions.  The only types which would seem
to be appropriate to specify the width are the ones which are
specified by width (i.e., int8_t et al).  In specifying the range one
might also note the minimum extrema as specified by any appropriate
standard, and any other standards-related constraints (e.g., for all
N, intN_t is exactly N bits in width, and if no such exact type is
available, intN_t is not defined).

> - signedness

Implied by the range.

> - appropriate format specifier and cast to use for printf()ing
>   variables of that type portably.

This just needs to be stated once: use %jd and (intmax_t) or %ju and
(uintmax_t) as appropriate for the signedness, unless it's one of the 
integral types which has a specifically-defined format (char, short,
int, long, long long, size_t, ptrdiff_t, and intmax_t).

-GAWollman

-- 
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick

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




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