TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: andrew clarke
date: 1995-07-25 00:53:16
subject: structure alignment

24 Jun 95 08:29, Paul Edwards wrote to Andrew Clarke:

 AC>> I wrote a small program to report sizeof(EZYMSGHDR).  Borland C++ 
 AC>> 3.1 reported the correct size, 186 bytes; Microsoft QuickC 2.5 
 AC>> reported 188 

 > If you say that 186 is the correct size, then that is because you are 
 > saying that there are 186 CHARACTERS in the structure, and you know 
 > EXACTLY which character is which.  So read a block of 186 characters, 
 > and CONVERT them into the local structure.

Thanks Paul, this makes perfect sense.  The Tobruk source code to deal with
FTN packets is a good demonstration of this.

 AC>> bytes, due to its default of 2-byte structure alignment.  Perhaps it 
 AC>> has something to do with EZYNETADDR being nested inside EZYMSGHDR.  
 AC>> I will investigate when I have some more time, but in my opinion the 
 AC>> behavior of QuickC's default structure aligning is unacceptable, 
 AC>> based on the above structure.

 > No, your code is unacceptable to ISO/IEC 9899:1990.  BFN.  Paul.

Heck, I must be in the wrong echo.  Are you sure this is AUST_C_HERE and
not AUST_ISO_C_HERE? :-)

I suppose it comes under "Platform dependant code".  Does
platform dependancy make code unacceptable to the ISO C standard?  I should
hope the aim of the standard would be to simply point out that it is
platform dependant.  If it was unacceptable then the majority of ANSI/ISO C
compilers would probably refuse to compile it! :-)

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™.