Skip to content

Fix value constraint for #line #3764

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 1 commit into from
Mar 11, 2022
Merged
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
2 changes: 1 addition & 1 deletion docs/preprocessor/hash-line-directive-c-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The **#line** directive tells the preprocessor to set the compiler's reported va

The compiler uses the line number and optional filename to refer to errors that it finds during compilation. The line number usually refers to the current input line, and the filename refers to the current input file. The line number is incremented after each line is processed.

The *digit-sequence* value can be any integer constant. Macro replacement can be used on the preprocessing tokens, but the result must evaluate to the correct syntax. The *filename* can be any combination of characters and must be enclosed in double quotation marks (`" "`). If *filename* is omitted, the previous filename remains unchanged.
The *digit-sequence* value can be any integer constant within the range from 0 to 2147483647, inclusive. Macro replacement can be used on the preprocessing tokens, but the result must evaluate to the correct syntax. The *filename* can be any combination of characters and must be enclosed in double quotation marks (`" "`). If *filename* is omitted, the previous filename remains unchanged.

You can alter the source line number and filename by writing a **`#line`** directive. The **`#line`** directive sets the value for the line that immediately follows the directive in the source file. The translator uses the line number and filename to determine the values of the predefined macros `__FILE__` and `__LINE__`. You can use these macros to insert self-descriptive error messages into the program text. For more information on these predefined macros, see [Predefined macros](../preprocessor/predefined-macros.md).

Expand Down