This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] manual: Refactor documentation of CHAR_BIT.
- From: Rical Jasan <ricaljasan at pacific dot net>
- To: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Cc: Joseph Myers <joseph at codesourcery dot com>, Zack Weinberg <zackw at panix dot com>, Carlos O'Donell <carlos at redhat dot com>, Michael Kerrisk <mtk dot manpages at gmail dot com>
- Date: Thu, 27 Jul 2017 04:28:03 -0700
- Subject: Re: [PATCH v3] manual: Refactor documentation of CHAR_BIT.
- Authentication-results: sourceware.org; auth=none
- References: <20170620112321.29338-1-ricaljasan@pacific.net> <20170620134418.31324-1-ricaljasan@pacific.net> <6d41a281-ca99-578d-e095-5c21f7c7fae4@redhat.com>
On 06/22/2017 06:23 AM, Florian Weimer wrote:
> On 06/20/2017 03:44 PM, Rical Jasan wrote:
>> @@ -628,11 +628,10 @@ There is no operator in the C language that can give you the number of
>> bits in an integer data type. But you can compute it from the macro
>> @code{CHAR_BIT}, defined in the header file @file{limits.h}.
>
> Sorry for scope creep, but the paragraph is inaccurate: We now have
> *_WIDTH macros, and you actually cannot easily compute the number of
> usable bits in a portable manner.
>
> Rest of the patch looks fine to me.
>
> Thanks,
> Florian
Can I commit the refactoring [1] and prepare a follow-up patch? The
issues you point out in the diff context go even further in this
section. The issues I see are:
* The name of the section itself is "Computing the Width of an Integer
Data Type", which is probably better named "Width of an Integer Type"
now (and would be consistent with the following section "Range of an
Integer Type").
* The bit vector example could use LONG_WIDTH.
* If the computation of the number of bits in any given data type
isn't possible using CHAR_BIT, that example needs to be either removed
or given a @strong{Portability Note:} (and updated with a better
example, if possible).
* Simply removing the inaccurate paragraph doesn't improve the
section; it should still say something to introduce CHAR_BIT, which
provided the practical example of computing LONGBITS for the bit vector
example that introduced the section.
Basically, it just needs to be rewritten...
Rical
[1] https://sourceware.org/ml/libc-alpha/2017-06/msg00915.html