You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/asctime-s-wasctime-s.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ The **asctime** function converts a time stored as a structure to a character st
85
85
86
86
The converted character string is also adjusted according to the local time zone settings. See the [time, _time32, _time64](time-time32-time64.md), [_ftime, _ftime32, _ftime64](ftime-ftime32-ftime64.md), and [localtime_s, _localtime32_s, _localtime64_s](localtime-s-localtime32-s-localtime64-s.md) functions for information about configuring the local time and the [_tzset](tzset.md) function for information about defining the time zone environment and global variables.
87
87
88
-
The string result produced by **asctime_s** contains exactly 26 characters and has the form `Wed Jan 02 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The new line character and the null character occupy the last two positions of the string. The value passed in as the second parameter should be at least this big. If it is less, an error code, **EINVAL**, will be returned.
88
+
The string result produced by **asctime_s** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The new line character and the null character occupy the last two positions of the string. The value passed in as the second parameter should be at least this big. If it is less, an error code, **EINVAL**, will be returned.
89
89
90
90
**_wasctime_s** is a wide-character version of **asctime_s**. **_wasctime_s** and **asctime_s** behave identically otherwise.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/asctime-wasctime.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ The **asctime** function converts a time stored as a structure to a character st
54
54
55
55
The converted character string is also adjusted according to the local time zone settings. For information about configuring the local time, see the [time](time-time32-time64.md), [_ftime](ftime-ftime32-ftime64.md), and [localtime](localtime-localtime32-localtime64.md) functions and the [_tzset](tzset.md) function for information about defining the time zone environment and global variables.
56
56
57
-
The string result produced by **asctime** contains exactly 26 characters and has the form `Wed Jan 02 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **asctime** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.
57
+
The string result produced by **asctime** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **asctime** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.
58
58
59
59
**_wasctime** is a wide-character version of **asctime**. **_wasctime** and **asctime** behave identically otherwise.
@@ -16,15 +16,55 @@ Treat the rest of the file as external for diagnostics reports.
16
16
17
17
## Remarks
18
18
19
-
Starting in Visual Studio 2017 version 15.6, the compiler lets you set two different default diagnostic warning levels on the command line. Normally, you use a [`/W0`, `/W1`, `/W2`, `/W3`, or `/W4`](../build/reference/compiler-option-warning-level.md) compiler option to specify a single diagnostic level for all code in a project. However, your project might include system header files or files from external libraries that generate warnings at the specified level. When you can't or don't want to edit these files, you can specify them as *external*. Files specified as external can have a separate compiler diagnostic level applied to them as a group. For more information on how to specify external files and the external warning level to the compiler, see [`/external`](../build/reference/external-external-headers-diagnostics.md).
19
+
The **`system_header`** pragma tells the compilerto show diagnostics at the level specified by the **`/external:Wn`** option for the rest of the current source file. For more information on how to specify external files and the external warning level to the compiler, see [`/external`](../build/reference/external-external-headers-diagnostics.md).
20
20
21
-
For example, a common scenario uses the **`/external:W1`**option to apply a **`/W1`** warning levelto external library header files, while you use **`/W4 /WX`**on your own code. Then you don't see minor diagnostics for the code that isn't yours.
21
+
The **`system_header`** pragma doesn't apply past the end of the current source file. In other words, it doesn't apply to files that include this file. The **`system_header`**pragma applies even if no other files are specified as external to the compiler. However, if no **`/external:Wn`**option level is specified, the compiler may issue a diagnostic and uses the same [warning level](../build/reference/compiler-option-warning-level.md) it applies to non-external files. Other pragma directives that affect warning behavior still apply after a **`system_header`**pragma. The effect of `#pragma system_header` is similar to the [`warning pragma`](warning.md):
22
22
23
-
The **`system_header`** pragma tells the compiler to show diagnostics at the **`/external:Wn`** level for the rest of the source file. The **`system_header`** pragma applies even if no other files are specified as external to the compiler. However, if no **`/external:Wn`** option level is specified, the compiler issues a diagnostic and uses the same warning level it applies to non-external files. Other pragma directives that affect warning behavior still apply after a **`system_header`** pragma.
23
+
```cpp
24
+
// If n represents the warning level specified by /external:Wn,
25
+
// #pragma system_header is roughly equivalent to:
26
+
#pragma warning( push, n )
27
+
28
+
// . . .
29
+
30
+
// At the end of the file:
31
+
#pragma warning( pop )
32
+
```
24
33
25
34
The **`system_header`** pragma is available starting in Visual Studio 2019 version 16.10.
26
35
36
+
## Example
37
+
38
+
This sample header shows how to mark the contents of a file as external:
39
+
40
+
```cpp
41
+
// library.h
42
+
// Use /external:Wn to set the compiler diagnostics level for this file's contents
43
+
44
+
#pragma once
45
+
#ifndef _LIBRARY_H // include guard for 3rd party interop
46
+
#define _LIBRARY_H
47
+
#pragma system_header
48
+
// The compiler applies the /external:Wn diagnostic level from here to the end of this file.
49
+
50
+
// . . .
51
+
52
+
// You can still override the external diagnostic level for warnings locally:
0 commit comments