TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: rowan crowe
from: andrew clarke
date: 1995-07-25 00:36:04
subject: structure alignment

>     This was something I was going to ask about; if structures are 
 > aligned to word boundaries, then what happens when you need to 
 > interface a language which doesn't? Your example shows a potential 
 > problem if one is not aware of the compiler aligning the structures 
 > behind your back.

Obviously one must be aware of the compiler's habits, or at the very least
aware that such a situation could occur.  I was not aware of this before,
but I am now and can deal with it - if I know it is occurring.  When you
don't realise you have structure misalignment then the real fun starts. :-)

 >     I can understand the advantage of aligning structures which are 
 > used in memory; but for writing to records on disk I consider it a big 
 > no-no.

Yep.  Problems with accessing structures which are aligned in a particular
manner in memory may also occur when one or more compilers/languages are
involved.  I guess the moral here is "know your compiler".

andrew

--- Msgedsq/2 3.10
* Origin: Blizzard of Ozz, Melbourne, Australia (3:633/267.1{at}fidonet)
SEEN-BY: 50/99 620/243 623/630 632/348 998 633/154 252 253 260 267 371 373
SEEN-BY: 634/384 635/301 502 503 544 636/100 639/100 120 711/401 409 410 430
SEEN-BY: 711/510 807 808 809 932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 633/267 252 371 635/503 50/99 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.