From Jason Turner

[cpp.embed.param.suffix]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkbi91n6a/{from.md → to.md} +33 -0
tmp/tmpkbi91n6a/{from.md → to.md} RENAMED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### suffix parameter <a id="cpp.embed.param.suffix">[[cpp.embed.param.suffix]]</a>
2
+
3
+ An *embed-parameter* of the form
4
+
5
+ ``` bnf
6
+ 'suffix (' pp-balanced-token-seqₒₚₜ ')'
7
+ ```
8
+
9
+ shall appear at most once in the *embed-parameter-seq*.
10
+
11
+ If the resource is empty, this *embed-parameter* is ignored. Otherwise,
12
+ the *pp-balanced-token-seq* is placed immediately after the
13
+ comma-delimited list of the integral constant expressions.
14
+
15
+ [*Example 1*:
16
+
17
+ ``` cpp
18
+ constexpr unsigned char whl[] = {
19
+ #embed "ches.glsl" \
20
+ prefix(0xEF, 0xBB, 0xBF, ) /* a sequence of bytes */ \
21
+ suffix(,)
22
+ 0
23
+ };
24
+ // always null-terminated, contains the sequence if not empty
25
+ constexpr bool is_empty = sizeof(whl) == 1 && whl[0] == '\0';
26
+ constexpr bool is_not_empty = sizeof(whl) >= 4
27
+ && whl[sizeof(whl) - 1] == '\0'
28
+ && whl[0] == '\xEF' && whl[1] == '\xBB' && whl[2] == '\xBF';
29
+ static_assert(is_empty || is_not_empty);
30
+ ```
31
+
32
+ — *end example*]
33
+