Page 1 of 1
[Implemented] Alignment in structures...
Posted: Fri Sep 14, 2012 9:26 am
by DoubleDutch
It would be good if there was a way to force alignment in specific structures, eg to align to a 4 byte boundary, also to align the overall size to a specific size or boundary too, etc
It would have to be recursive - so if you had something like a points structure (2 words, x,y) within your structure, then that too would be aligned for the x and the y.
Re: Alignment in structures...
Posted: Fri Sep 14, 2012 9:35 am
by wilbert
Would indeed be very useful.
16 bytes aligned would also be nice.
Re: Alignment in structures...
Posted: Fri Sep 14, 2012 10:26 am
by DoubleDutch
Looking at the gesture problem, it seems the recursive idea isn't a good one as MS don't seem to do this in theirs - which I think is pretty odd btw. ;p
Re: Alignment in structures...
Posted: Fri Sep 14, 2012 10:47 am
by Josh
Re: Alignment in structures...
Posted: Fri Sep 14, 2012 11:12 am
by DoubleDutch
Thanks Josh, I did a search before I posted ('structure align') but didn't find anything.

Re: Alignment in structures...
Posted: Sat Sep 15, 2012 8:55 am
by User_Russian
Good idea.
It would be great if you added the ability to align the structures.
http://www.purebasic.fr/english/viewtop ... 2&p=383107
Re: Alignment in structures...
Posted: Sat Sep 15, 2012 9:18 am
by inc.
totally agree,
its everytime a mess when porting header files from C based libraries to PB beeing forced to add padding manually.