Skip to content

Commit 6fec72c

Browse files
TylerMSFTTylerMSFT
authored andcommitted
wording - fix trailing slash
1 parent 0161753 commit 6fec72c

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎docs/c-language/c-keywords.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The following keywords and special identifiers are recognized by the Microsoft C
111111
**`dllexport`**<sup>4</sup>\
112112
**`__inline`**<sup>5</sup>\
113113
**`__leave`**<sup>5</sup>\
114-
**`static_assert`**<sup>6</sup>\
114+
**`static_assert`**<sup>6</sup>
115115
:::column-end:::
116116
:::row-end:::
117117

‎docs/c-language/static-assert-c.md‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ helpviewer_keywords: ["assertions [C], _Static_assert, static_assert"]
88

99
# _Static_assert keyword and static_assert macro (C11)
1010

11-
New in C11. Tests an assertion at compile time. If the specified constant expression is **`false`**, the compiler displays the specified message and the compilation fails with error C2338; otherwise, there's no effect.
11+
Tests an assertion at compile time. If the specified constant expression is **`false`**, the compiler displays the specified message and the compilation fails with error C2338; otherwise, there's no effect. New in C11.
1212

1313
**`_Static_assert`** is a keyword introduced in C11.
1414
**`static_assert`** is a macro, introduced in C11, that maps to the **`_Static_assert`** keyword.
@@ -23,26 +23,24 @@ static_assert(constant-expression, string-literal);
2323
### Parameters
2424

2525
*constant-expression*\
26-
An integral constant expression that can be evaluated at compile time. If the evaluated expression is zero (false), the *string-literal* parameter is displayed and the compilation fails with an error. If the expression is nonzero (true), then there's no effect.
26+
An integral constant expression that can be evaluated at compile time. If the expression is zero (false), displays the *string-literal* parameter and the compilation fails with an error. If the expression is nonzero (true), then there's no effect.
2727

2828
*string-literal*\
29-
The message to display if the *constant-expression* evaluates to zero (false). The message is a string of characters using the [base character set](../c-language/ascii-character-set.md) of the compiler; that is, not [multibyte or wide characters](../c-language/multibyte-and-wide-characters.md).
29+
The message displayed if *constant-expression* evaluates to zero (false). The message must be made using the [base character set](../c-language/ascii-character-set.md) of the compiler. The characters can't be [multibyte or wide characters](../c-language/multibyte-and-wide-characters.md).
3030

3131
## Remarks
3232

33-
The **`_Static_assert`** keyword, and the **`static_assert`** macro, test a software assertion at compile time. They can be used at global or function scope.
33+
The **`_Static_assert`** keyword, and the **`static_assert`** macro, both test a software assertion at compile time. They can be used at global or function scope.
3434

3535
In contrast, the [assert macro and _assert and _wassert functions](../c-runtime-library/reference/assert-macro-assert-wassert.md) test a software assertion at runtime and incur a runtime cost.
3636

3737
**Microsoft-specific behavior**\
3838

39-
In C, if you don't include <assert.h>, the Microsoft Visual C/C++ compiler treats **`static_assert`** as a keyword that maps to **`_Static_assert`**. The reason for this mapping is that C++ has a **`static_assert`** keyword.
40-
41-
Using the **`static_assert`** macro is preferred because the same code will work in both C and C++.
39+
In C, when you don't include <assert.h>, the Microsoft Visual C/C++ compiler treats **`static_assert`** as a keyword that maps to **`_Static_assert`**. Using the **`static_assert`** macro is preferred because the same code will work in both C and C++.
4240

4341
## Example of a compile-time assert
4442

45-
In the following example, **`static_assert`** and **`_Static_assert`** are used to verify that the `Items` enum only contains three elements, and that integers are 32 bits wide.
43+
In the following example, **`static_assert`** and **`_Static_assert`** are used to verify how many elements are in an enum and that integers are 32 bits wide.
4644

4745
```C
4846
// requires /std:c11 or higher

0 commit comments

Comments
 (0)