File tree 1 file changed +4
-2
lines changed
reference/src/representation
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ Note that the `TwoCasesVariantA` and `TwoCasesVariantB` structs are
189
189
` #[repr(C)] ` ; this is needed to ensure that the ` TwoCasesTag ` value
190
190
appears at offset 0 in both cases, so that we can read it to determine
191
191
the current variant.
192
-
192
+
193
193
#### C-compatible representation selected
194
194
195
195
When the ` #[repr] ` tag includes ` C ` , e.g., ` #[repr(C)] ` or `#[ repr(C,
@@ -203,7 +203,9 @@ variants.
203
203
204
204
This layout, while more compatible and arguably more obvious, is also
205
205
less efficient than the non-C compatible layout in some cases in terms
206
- of total size.
206
+ of total size. For example, the ` TwoCases ` example given in the
207
+ preivous section only occupies 4 bytes with ` #[repr(u8)] ` , but would
208
+ occupy 6 bytes with ` #[repr(C, u8)] ` , as more padding is required.
207
209
208
210
** Example.** The following enum:
209
211
You can’t perform that action at this time.
0 commit comments