|
look at the virtual address of the object in storage. If the low-order byte of the address is a zero, the object is 16-byte aligned. If the low order address byte is even (0, 2, 4, ...) the object is at least 2-byte aligned. And so forth. Richard Jackson mailto:richardjackson@richardjackson.net http://www.richardjacksonltd.com Voice: 1 (303) 808-8058 Fax: 1 (303) 663-4325 -|-----Original Message----- -|From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On -|Behalf Of Peter Dow -|Sent: Tuesday, October 10, 2000 1:27 PM -|To: RPG400-L@midrange.com -|Subject: Re: RPG400-L Digest V2 #357 -| -| -|Hi Ken, -| -|How can one tell what boundary a data structure, or any other -|field for that -|matter, is aligned on? -| -|Curious, -|Peter Dow -|Dow Software Services, Inc. -|909 425-0194 voice -|909 425-0196 fax -| -|----- Original Message ----- -|From: "Sims, Ken" <KSIMS@SOUTHERNWINE.com> -|To: <rpg400-l@midrange.com> -|Sent: Tuesday, October 10, 2000 10:08 AM -|Subject: RE: RPG400-L Digest V2 #357 -| -| -|> Hi Peter - -|> -|> >The V4R4 RPG ILE manual says: -|> ... -|> >The position they're talking about is the position of the -|subfield within -|a -|> >data structure, so if the above is true, one would have to assume that -|the -|> >data structure begins on a 16-byte boundary. It would be nice if they -|> >explicitly said that, and assured us it won't change from release to -|> >release. -|> -|> Based on my experimentation, since the compiler rejects pointers defined -|> with from/to positioning that is not on a 16-byte boundary, it appears -|that -|> data structures with pointers are always aligned on a 16-byte boundary. -|> Only pointer fields *have* to be aligned on a 16-byte boundary. -| No other -|> fields *have* to be aligned on any particular boundary, and no other -|fields -|> need a 16-byte alignment for best performance; therefore there -|is nothing -|to -|> imply that any data structure not containing pointers is aligned on a -|> 16-byte boundary. -|> -|> The data structure being discussed in this thread does not -|contain actual -|> pointer fields since it is an externally described data structure using -|> character fields to hold pointers, therefore there is no reason -|to assume -|> any particular alignment. -|> -|> The use of the ALIGN keyword does not imply changing the data structure -|> itself to ANY particular byte alignment, only to adding padding between -|> individual fields in the data structure to align float, signed integer, -|and -|> unsigned integer fields for performance. -|> -|> Ken -|> Southern Wine and Spirits of Nevada, Inc. -|> Opinions expressed are my own and do not necessarily represent the views -|of -|> my employer or anyone in their right mind. -|> -|> +--- -|> | This is the RPG/400 Mailing List! -|> | To submit a new message, send your mail to RPG400-L@midrange.com. -|> | To subscribe to this list send email to RPG400-L-SUB@midrange.com. -|> | To unsubscribe from this list send email to -|RPG400-L-UNSUB@midrange.com. -|> | Questions should be directed to the list owner/operator: -|david@midrange.com -|> +--- -| -|+--- -|| This is the RPG/400 Mailing List! -|| To submit a new message, send your mail to RPG400-L@midrange.com. -|| To subscribe to this list send email to RPG400-L-SUB@midrange.com. -|| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. -|| Questions should be directed to the list owner/operator: -|david@midrange.com -|+--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.