tmp/tmpanj0pnvm/{from.md → to.md}
RENAMED
|
@@ -2,31 +2,31 @@
|
|
| 2 |
|
| 3 |
For compatibility with the C standard library, the C++ standard library
|
| 4 |
provides the *C headers* shown in [[c.headers]]. The intended use of
|
| 5 |
these headers is for interoperability only. It is possible that C++
|
| 6 |
source files need to include one of these headers in order to be valid
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
[*Note 1*: The C headers either have no effect, such as `<stdbool.h>`
|
| 11 |
and `<stdalign.h>`, or otherwise the corresponding header of the form
|
| 12 |
`<cname>` provides the same facilities and assuredly defines them in
|
| 13 |
namespace `std`. — *end note*]
|
| 14 |
|
| 15 |
[*Example 1*:
|
| 16 |
|
| 17 |
-
The following source file is both valid C++ and valid
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
-
#include <
|
| 23 |
#include <stddef.h> // for size_t
|
| 24 |
|
| 25 |
#ifdef __cplusplus // see [cpp.predefined]
|
| 26 |
extern "C" // see [dcl.link]
|
| 27 |
#endif
|
| 28 |
-
void f(
|
| 29 |
```
|
| 30 |
|
| 31 |
— *end example*]
|
| 32 |
|
|
|
|
| 2 |
|
| 3 |
For compatibility with the C standard library, the C++ standard library
|
| 4 |
provides the *C headers* shown in [[c.headers]]. The intended use of
|
| 5 |
these headers is for interoperability only. It is possible that C++
|
| 6 |
source files need to include one of these headers in order to be valid
|
| 7 |
+
C. Source files that are not intended to also be valid C should not use
|
| 8 |
+
any of the C headers.
|
| 9 |
|
| 10 |
[*Note 1*: The C headers either have no effect, such as `<stdbool.h>`
|
| 11 |
and `<stdalign.h>`, or otherwise the corresponding header of the form
|
| 12 |
`<cname>` provides the same facilities and assuredly defines them in
|
| 13 |
namespace `std`. — *end note*]
|
| 14 |
|
| 15 |
[*Example 1*:
|
| 16 |
|
| 17 |
+
The following source file is both valid C++ and valid C. Viewed as C++,
|
| 18 |
+
it declares a function with C language linkage; viewed as C it simply
|
| 19 |
+
declares a function (and provides a prototype).
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
+
#include <uchar.h> // for char8_t in C, not necessary in C++{}
|
| 23 |
#include <stddef.h> // for size_t
|
| 24 |
|
| 25 |
#ifdef __cplusplus // see [cpp.predefined]
|
| 26 |
extern "C" // see [dcl.link]
|
| 27 |
#endif
|
| 28 |
+
void f(char8_t s[], size_t n);
|
| 29 |
```
|
| 30 |
|
| 31 |
— *end example*]
|
| 32 |
|