tmp/tmpmu_0j0wd/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### `if_empty` parameter <a id="cpp.embed.param.if.empty">[[cpp.embed.param.if.empty]]</a>
|
| 2 |
+
|
| 3 |
+
An embed-parameter of the form
|
| 4 |
+
|
| 5 |
+
``` bnf
|
| 6 |
+
'if_empty (' pp-balanced-token-seqₒₚₜ ')'
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
shall appear at most once in the *embed-parameter-seq*.
|
| 10 |
+
|
| 11 |
+
If the resource is not empty, this *embed-parameter* is ignored.
|
| 12 |
+
Otherwise, the `#embed` directive is replaced by the
|
| 13 |
+
*pp-balanced-token-seq*.
|
| 14 |
+
|
| 15 |
+
[*Example 1*:
|
| 16 |
+
|
| 17 |
+
`limit(0)` affects when a resource is considered empty. Therefore, the
|
| 18 |
+
following program:
|
| 19 |
+
|
| 20 |
+
``` cpp
|
| 21 |
+
#embed </owo/uwurandom> \
|
| 22 |
+
if_empty(42203) limit(0)
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
expands to
|
| 26 |
+
|
| 27 |
+
``` cpp
|
| 28 |
+
42203
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
— *end example*]
|
| 32 |
+
|
| 33 |
+
[*Example 2*:
|
| 34 |
+
|
| 35 |
+
This resource is considered empty due to the `limit(0)`
|
| 36 |
+
*embed-parameter*, always, including in `__has_embed` clauses.
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
int infinity_zero () {
|
| 40 |
+
#if __has_embed(</owo/uwurandom> limit(0) prefix(some tokens)) == __STDC_EMBED_EMPTY__
|
| 41 |
+
// if </owo/uwurandom> exists, this conditional inclusion branch is taken and the function returns 0.
|
| 42 |
+
return 0;
|
| 43 |
+
#else
|
| 44 |
+
// otherwise, the resource does not exist
|
| 45 |
+
#error "The resource does not exist"
|
| 46 |
+
#endif
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
— *end example*]
|
| 51 |
+
|