Skip to content

docs: few minor fixes. #4653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/c-language/c-bit-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The *`constant-expression`* specifies the width of the field in bits. The *`type

Unnamed bit fields can't be referenced, and their contents at run time are unpredictable. They can be used as "dummy" fields, for alignment purposes. An unnamed bit field whose width is specified as 0 guarantees that storage for the member following it in the *struct-declaration-list* begins on an **`int`** boundary.

Bit fields must also be long enough to contain the bit pattern. For example, these two statements aren't legal:
The number of bits in a bit field must be less than or equal to the size of the underlying type. For example, these two statements aren't legal:

```C
short a:17; /* Illegal! */
Expand Down Expand Up @@ -72,7 +72,7 @@ the bits of `test` would be arranged as follows:
cccccccb bbbbaaaa
```

Since the 8086 family of processors stores the low byte of integer values before the high byte, the integer `0x01F2` would be stored in physical memory as `0xF2` followed by `0x01`.
Since the 8086 family of processors store the low byte of integer values before the high byte, the integer `0x01F2` would be stored in physical memory as `0xF2` followed by `0x01`.

The ISO C99 standard lets an implementation choose whether a bit field may straddle two storage instances. Consider this structure, which stores bit fields that total 64 bits:

Expand Down
2 changes: 1 addition & 1 deletion docs/c-language/storage-and-alignment-of-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where *n* is the packing size expressed with the /Zp[*n*] option and *item* is t

To use the `pack` pragma to specify packing other than the packing specified on the command line for a particular structure, give the `pack` pragma, where the packing size is 1, 2, 4, 8, or 16, before the structure. To reinstate the packing given on the command line, specify the `pack` pragma with no arguments.

Bit fields default to size **`long`** for the Microsoft C compiler. Structure members are aligned on the size of the type or the /Zp[*n*] size, whichever is smaller. The default size is 4.
For the Microsoft C compiler, bit fields default to a size of 4 bytes, which is a **`long`** data type. Structure members are aligned on the size of the type or the /Zp[*n*] size, whichever is smaller.

**END Microsoft Specific**

Expand Down
2 changes: 1 addition & 1 deletion docs/c-language/union-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Nested unions can be declared anonymously when they're members of another struct
struct str
{
int a, b;
union / * Unnamed union */
union /* Unnamed union */
{
char c[4];
long l;
Expand Down