StructureOffset (or whatever sounds best)
Posted: Sat Jan 26, 2008 1:30 am
One day when the team is idling along with little to do (:)) perhaps we could have a way to reposition fields within a structure without using StructureUnion.
For example:
Which would have myByte and aWord sharing the same start address, and everything after myByte increment offsets accordingly.
Currently the same thing can be achieved using StructureUnion but this requires (where more than one field variable is involved) additional structures.
The advantages are:
1: Improved readability in code when using the structure.
2: Reduced typing when cutting code using "complex" structures.
Just a low priority wish.
For example:
Code: Select all
Structure one
myLong.l
myByte.b
myWord.w
StructureOffset = myByte ; predefined field, optional for absolute, eg, 4
aWord.w
aByte.b
EndStructure
var.one
var\aWord = 1
Currently the same thing can be achieved using StructureUnion but this requires (where more than one field variable is involved) additional structures.
Code: Select all
Structure bitA
myByte.b
myWord.w
EndStructure
Structure bitB
aWord.w
aByte.b
EndStructure
Structure one
myLong.l
StructureUnion
partA.bitA
partB.bitB
EndStructureUnion
EndStructure
var.one
var\partB\aWord = 1
1: Improved readability in code when using the structure.
2: Reduced typing when cutting code using "complex" structures.
Just a low priority wish.
