POSIX mandates in Definition 3.84[1] that a byte is "exactly an octet" (8 bits). Does that make it safe to assume that a char
is 8 bits on all Linux and FreeBSD systems (at least)?
I have some understanding of what POSIX is and what it tries to achieve, but I don't know to what extent Linux and *BSD systems "must" conform to it. For example, Linux CLI tools often do things that aren't part of their POSIX specifications (though perhaps it's always a superset, so that anything in the POSIX specification still holds true).
[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_87
EDIT: I am well aware that the C standard doesn't guarantee an 8-bit byte. I'm asking specifically about whether the POSIX mandate means that "8-bit byte" is a safe assumption on Linux and FreeBSD.
From https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html :
{CHAR_BIT}
Number of bits in a type char.
[CX] [Option Start] Value: 8 [Option End]
The POSIX issues 7 and 6 specifications state that char has 8 bits.
POSIX standard before issue 6 did not require that. From the same site:
CHANGE HISTORY
Issue 6
The values for the limits {CHAR_BIT}, {SCHAR_MAX}, and {UCHAR_MAX} are now required to be 8, +127, and 255, respectively.
I don't know to what extent Linux and *BSD systems "must" conform to it
To no extent. Linux and BSD systems may not conform to any standard and may break any conformance at any time. There is no "POSIX standard police" that would enforce anything. POSIX certifications are very rare. Both systems come with a license that clearly states that there are no guaranteeing nothing. Example from BSD:
THIS SOFTWARE IS PROVIDED `'AS IS″ AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.