benefit of .struct

This commit is contained in:
pkivolowitz 2022-11-03 10:40:39 -05:00 committed by GitHub
parent 3e207094c9
commit bb1bee8c2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.