From bb1bee8c2c8661f3be3775e62c7d259efb1ecd51 Mon Sep 17 00:00:00 2001 From: pkivolowitz Date: Thu, 3 Nov 2022 10:40:39 -0500 Subject: [PATCH] benefit of .struct --- section_1/structs/defining.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/section_1/structs/defining.md b/section_1/structs/defining.md index 3fd9322..971d307 100644 --- a/section_1/structs/defining.md +++ b/section_1/structs/defining.md @@ -115,7 +115,8 @@ Foo.c: // 23 fmt: .asciz "%p a: 0x%x b: 0x%x c: 0x%x\n" // 27 ``` -We aren't sure this method has anything to commend it over the previous -method other than it does emphasize that offsets are relative to the -data member that comes before it. +This method has a *substantial* benefit over the previous methods. Imagine +you need to insert a new field between `Foo.a` and `Foo.b`. Simply do so. +If you're using this third method, which is based on relative offsets, the +assembler will do the work of adjusting the following offsets for you.