File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 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() {
226226struct.size = current_offset + padding_needed_for(current_offset, struct.alignment);
227227```
228228
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+
229237> Note: This algorithm can produce zero-sized structs. This differs from
230238> C where structs without data still have a size of one byte.
231239
@@ -374,3 +382,4 @@ used with any other representation.
374382[ `C` ] : #the-c-representation
375383[ primitive representations ] : #primitive-representations
376384[ `transparent` ] : #the-transparent-representation
385+ [ `Layout` ] : ../std/alloc/struct.Layout.html
You can’t perform that action at this time.
0 commit comments