File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,14 @@ for field in struct.fields_in_declaration_order() {
226
226
struct.size = current_offset + padding_needed_for(current_offset, struct.alignment);
227
227
```
228
228
229
+ <div class =" warning " >
230
+
231
+ Warning: This pseudocode uses a naive algorithm that ignores overflow issues for
232
+ the sake of clarity. To perform memory layout computations in actual code, use
233
+ [ ` Layout ` ] .
234
+
235
+ </div >
236
+
229
237
> Note: This algorithm can produce zero-sized structs. This differs from
230
238
> C where structs without data still have a size of one byte.
231
239
@@ -374,3 +382,4 @@ used with any other representation.
374
382
[ `C` ] : #the-c-representation
375
383
[ primitive representations ] : #primitive-representations
376
384
[ `transparent` ] : #the-transparent-representation
385
+ [ `Layout` ] : ../std/alloc/struct.Layout.html
You can’t perform that action at this time.
0 commit comments