Skip to content

Commit

Permalink
Add note about multi-buffer alignment in size prefixed buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelfj committed Oct 26, 2016
1 parent cef5b2b commit e636f4b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ The size the size of the buffer excluding the size prefix. When
verifying buffers the buffer and size arguments should be used. See also
`monster_test.c` for an example.

Note that the size prefix ensures internal alignment but does not
guarantee that the next buffer in a file can be appended directly
because the next buffers alignment is unknown and becuase it potentially
wastes padding bytes. The buffer size at offset 0 can increased to the
needed alignment as long as endianness is handled and the size of the
size field is subtracted, and zeroes are appended as necesary.

## Namespaces

The generated code is typically wrapped in a custom namespace and
Expand Down

0 comments on commit e636f4b

Please sign in to comment.