Re: [PATCH] New Page: byte.7: Document what "byte" means, theory and practice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 21 Jun 2018 00:28:27 +0200, Jakub Wilk wrote:

> POSIX actually requires that CHAR_BIT is exactly 8.
>
> It seems that at least some parts of the man page you wrote is based on 
> the incorrect assumption than CHAR_BIT can be greater than 8 on POSIX 
> systems.

Thanks for the reply.

There are 2 threads in the man page:

* Documentation of  the fact that Linux/POSIX  define a byte
  to be 8 bits, which I took to imply that CHAR_BIT on POSIX
  is indeed supposed to be 8.

* Documentation  of  the fact  that  in  general, there's  a
  discrepancy  in definitions  that needs  to be  taken into
  acount when dealing with the portability  of both programs
  and their data.

Of  course, perhaps  the man  page should  be a  little more
explicit  in  documenting  that  POSIX  conformance  demands
CHAR_BIT be  8 (e.g., by  quoting the constraints  placed on
<limits.h>);  at  one  point,  I did  have  a  code  example
demonstrating a test  for POSIX compatibility as  a means by
which to  imply an 8-bit  char, but  I removed it  because I
thought it was superfluous.

That  being said,  POSIX compatibility  is not  the same  as
POSIX-like; to be extra careful, it's probably better not to
rely on a  resemblance to POSIX, but instead  to use testing
that is more direct, which is why the examples don't rely on
just POSIX for determining CHAR_BIT (after all, you can just
test CHAR_BIT itself). More to the point, it is not intended
to help programmers who are targeting solely POSIX.

Is there something in particular that is outright incorrect?

Sincerely,
Michael Witten
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux