From Jason Turner

[cpp.embed.param.limit]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz43xoadh/{from.md → to.md} +60 -0
tmp/tmpz43xoadh/{from.md → to.md} RENAMED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### limit parameter <a id="cpp.embed.param.limit">[[cpp.embed.param.limit]]</a>
2
+
3
+ An *embed-parameter* of the form `limit (` *pp-balanced-token-seq* `)`
4
+ specifies the maximum possible number of elements in the comma-delimited
5
+ list. It shall appear at most once in the *embed-parameter-seq*. The
6
+ preprocessing token `defined` shall not appear in the
7
+ *pp-balanced-token-seq*.
8
+
9
+ The *pp-balanced-token-seq* is evaluated as a *constant-expression*
10
+ using the rules as described in conditional inclusion [[cpp.cond]], but
11
+ without being processed as in normal text an additional time.
12
+
13
+ [*Example 1*:
14
+
15
+ ``` cpp
16
+ #undef DATA_LIMIT
17
+ #if __has_embed(<data.dat> limit(DATA_LIMIT))
18
+ #endif
19
+ ```
20
+
21
+ is equivalent to:
22
+
23
+ ``` cpp
24
+ #if __has_embed(<data.dat> limit(0))
25
+ #endif
26
+ ```
27
+
28
+ — *end example*]
29
+
30
+ [*Example 2*:
31
+
32
+ ``` cpp
33
+ #embed <data.dat> limit(__has_include("a.h"))
34
+
35
+ #if __has_embed(<data.dat> limit(__has_include("a.h")))
36
+ // ill-formed: __has_include[cpp.cond] cannot appear here
37
+ #endif
38
+ ```
39
+
40
+ — *end example*]
41
+
42
+ The *constant-expression* shall be an integral constant expression whose
43
+ value is greater than or equal to zero. The resource-count
44
+ [[cpp.embed.gen]] becomes implementation-resource-count, if the value of
45
+ the *constant-expression* is greater than implementation-resource-count;
46
+ otherwise, the value of the *constant-expression*.
47
+
48
+ [*Example 3*:
49
+
50
+ ``` cpp
51
+ constexpr unsigned char sound_signature[] = {
52
+ // a hypothetical resource capable of expanding to four or more elements
53
+ #embed <sdk/jump.wav> limit(2+2)
54
+ };
55
+
56
+ static_assert(sizeof(sound_signature) == 4); // OK
57
+ ```
58
+
59
+ — *end example*]
60
+