If 1 bool is 1 byte [8 bits], will the 4-point packed structure be 32 bits or 4? The pack directive removes the alignment requirement, but will it make [buse] memory more efficient?
Yes. Even a packed boolean structure will use at least 8 bits in a boolean. If you do not use bit fields .
4 bools.
bool
Everyone boolneeds a unique address (since you can accept the address bool). If you use a field bit, you can reduce the size to 1 bool, but you cannot get the address of a single bit field.
bool . , , int (, , ). sizeof (bool) 1, bools 4 ( , 32 )
, , :
std::vector<bool>
: http://www.cplusplus.com/reference/stl/vector/
( ) , . , , .
FD_SET.
. .
:
5.3.3
sizeof . , , . sizeof , , l, -. sizeof (char), sizeof ( char) sizeof ( char) 1; sizeof, (3.9.1), . [: - , sizeof (bool) sizeof (wchar_t) .69)] [: . 1.7 3.9 . ]