google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
70 stars 21 forks source link

Support syntax to specify field is placed directly after previous one #22

Closed fsareshwala closed 2 years ago

fsareshwala commented 2 years ago

Emboss supports overlapping fields; fat fingering an incorrect offset is completely valid but an easy mistake to make. It would be nice to be able to have syntax to simply say that this field is placed directly after the previously defined one.

Potential Implementation The .emb language syntax is updated to indicate a field should be placed directly after the previous one. The generated C++ code follows this guidance and computes the offset of a field automatically. Overlapping field syntax is retained for backwards compatibility.