Skip to content

Commit b38485b

Browse files
authored
Merge pull request MicrosoftDocs#3276 from MicrosoftDocs/master
11/10/2020 AM Publish
2 parents 3f0c1dc + cc08b54 commit b38485b

File tree

4 files changed

+185
-175
lines changed

4 files changed

+185
-175
lines changed

docs/c-language/parsing-c-command-line-arguments.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: "Parsing C Command-Line Arguments"
3-
ms.date: "11/04/2016"
4-
helpviewer_keywords: ["quotation marks, command-line arguments", "double quotation marks", "command line, parsing", "parsing, command-line arguments", "startup code, parsing command-line arguments"]
3+
description: "Learn how the Microsoft C runtime startup code interprets command-line arguments to create the argv and argc parameters."
4+
ms.date: 11/09/2020
5+
helpviewer_keywords: ["quotation marks, command-line arguments", "double quotation marks", "double quote marks", "command line, parsing", "parsing, command-line arguments", "startup code, parsing command-line arguments"]
56
ms.assetid: ffce8037-2811-45c4-8db4-1ed787859c80
67
---
78
# Parsing C Command-Line Arguments
@@ -12,15 +13,17 @@ Microsoft C startup code uses the following rules when interpreting arguments gi
1213

1314
- Arguments are delimited by white space, which is either a space or a tab.
1415

15-
- A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument. Note that the caret (**^**) is not recognized as an escape character or delimiter.
16+
- The first argument (`argv[0]`) is treated specially. It represents the program name. Because it must be a valid pathname, parts surrounded by double quote marks (**`"`**) are allowed. The double quote marks aren't included in the `argv[0]` output. The parts surrounded by double quote marks prevent interpretation of a space or tab character as the end of the argument. The later rules in this list don't apply.
1617

17-
- A double quotation mark preceded by a backslash, **\\"**, is interpreted as a literal double quotation mark (**"**).
18+
- A string surrounded by double quote marks is interpreted as a single argument, whether or not it contains white space. A quoted string can be embedded in an argument. The caret (**`^`**) isn't recognized as an escape character or delimiter. Within a quoted string, a pair of double quote marks is interpreted as a single escaped double quote mark. If the command line ends before a closing double quote mark is found, then all the characters read so far are output as the last argument.
1819

19-
- Backslashes are interpreted literally, unless they immediately precede a double quotation mark.
20+
- A double quote mark preceded by a backslash (**`\"`**) is interpreted as a literal double quote mark (**`"`**).
2021

21-
- If an even number of backslashes is followed by a double quotation mark, then one backslash (**\\**) is placed in the `argv` array for every pair of backslashes (**\\\\**), and the double quotation mark (**"**) is interpreted as a string delimiter.
22+
- Backslashes are interpreted literally, unless they immediately precede a double quote mark.
2223

23-
- If an odd number of backslashes is followed by a double quotation mark, then one backslash (**\\**) is placed in the `argv` array for every pair of backslashes (**\\\\**) and the double quotation mark is interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (**"**) to be placed in `argv`.
24+
- If an even number of backslashes is followed by a double quote mark, then one backslash (**`\`**) is placed in the `argv` array for every pair of backslashes (**`\\`**), and the double quote mark (**`"`**) is interpreted as a string delimiter.
25+
26+
- If an odd number of backslashes is followed by a double quote mark, then one backslash (**`\`**) is placed in the `argv` array for every pair of backslashes (**`\\`**). The double quote mark is interpreted as an escape sequence by the remaining backslash, causing a literal double quote mark (**`"`**) to be placed in `argv`.
2427

2528
This list illustrates the rules above by showing the interpreted result passed to `argv` for several examples of command-line arguments. The output listed in the second, third, and fourth columns is from the ARGS.C program that follows the list.
2629

@@ -31,13 +34,13 @@ This list illustrates the rules above by showing the interpreted result passed t
3134
|`a\\\b d"e f"g h`|`a\\\b`|`de fg`|`h`|
3235
|`a\\\"b c d`|`a\"b`|`c`|`d`|
3336
|`a\\\\"b c" d e`|`a\\b c`|`d`|`e`|
37+
|`a"b"" c d`|`ab" c d`|||
3438

3539
## Example
3640

3741
### Code
3842

3943
```c
40-
// Parsing_C_Commandline_args.c
4144
// ARGS.C illustrates the following variables used for accessing
4245
// command-line arguments and environment variables:
4346
// argc argv envp

docs/code-quality/c26443.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ ms.topic: "reference"
66
f1_keywords: ["C26443"]
77
helpviewer_keywords: ["C26443"]
88
dev_langs: ["C++"]
9+
description: Rule concerning overriding destructors
910
---
11+
1012
# C26443 NO_EXPLICIT_DTOR_OVERRIDE
1113

1214
"Overriding destructor should not use explicit 'override' or 'virtual' specifiers."
1315

16+
This warning was removed as of Visual Studio 16.8 Preview 4 to reflect [changes to C.128 in the C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/pull/1448).
17+
1418
## C++ Core Guidelines
1519

1620
[C.128: Virtual functions should specify exactly one of virtual, override, or final](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md).

0 commit comments

Comments
 (0)