[Implemented] Alignment in structures...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

[Implemented] Alignment in structures...

Post 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.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Alignment in structures...

Post by wilbert »

Would indeed be very useful.
16 bytes aligned would also be nice.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Alignment in structures...

Post 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
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Alignment in structures...

Post by Josh »

sorry for my bad english
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Alignment in structures...

Post by DoubleDutch »

Thanks Josh, I did a search before I posted ('structure align') but didn't find anything. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Alignment in structures...

Post 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
inc.
Enthusiast
Enthusiast
Posts: 406
Joined: Thu May 06, 2004 4:28 pm
Location: Cologne/GER

Re: Alignment in structures...

Post by inc. »

totally agree,

its everytime a mess when porting header files from C based libraries to PB beeing forced to add padding manually.
Check out OOP support for PB here!
Post Reply