TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: Stas Degteff
from: andrew clarke
date: 2003-01-11 21:25:08
subject: XMSG size (Re^3: dates)

Message text below...

Thu 2002-11-21 15:46, andrew clarke (3:633/267) wrote to Stas Degteff:

 ac>>>>> #define XMSG_SIZE (94 + XMSG_FROM_SIZE + XMSG_TO_SIZE +
 ac>>>>> XMSG_SUBJ_SIZE)

 >>>> This define is incorrect. For XMSG size must be use sizeof(XMSG)...

 ac>>> Then why is it there?

 >> 'sizeof(XMSG)' is compiler-independed, '#pragma pack' is not.

 > That was why the #pragma packs were surrounded by #ifdefs in SMAPI 1.4. 

 > (Although admittedly they unnecessarily encompassed more than just the 
 > structs.)

 ac>>> Do you understand the problem I'm talking about AT ALL?

 >> I understand this problem. But i can't be resolve it for all husky 
 >> modules and all developers :)

 > The problem should at least be fixed for all supported compilers.  This 
 > is not difficult.

I just discovered smapi.pas in smapi-2.0.1 now.  Here's what it has to say
about smapi's lack of structure alignment:

{: NOTE: Unfortunately it turned out that the structures that are passed   
      between smapi and any calling programs are in no way align
controlled,
         that is, how they are aligned is left to the compiler.
         That means that if you are not using the same compiler for your
         program that was used to compile the libraries, chances are that
         you will have an alignment problem resulting in fields of the
         structures being out of sync, e.g. you are reading something totally
         different from what the library put there.
         Because of this and because I don't want to chase a moving target
         like this, I will stop maintaining smapi.pas and fidoconf.pas.
         That probably means that husky has now become a project that can
         only be used by C programmers, unless somebody else wants
         to go through the trouble.
         One possible solution I can think of, would be having an interface
         layer that converts the randomly aligned structures to other
         structures that are fixed. I might do it, maybe, if I don't find
         anything else to waste my time on. But this is rather unlikely,
         because it has to be done in C and that is definitely not my
         favourite programming language.
         Please leave this comment in here, so nobody else will waste time
         trying to figure out why the data his programs reads is wrong.
         2001-07-22 twm }

-- mail{at}ozzmosis.com

--- Msged/NT 6.1.1
* Origin: Blizzard of Ozz, Mt Eliza, Victoria, Australia (3:633/267.1)
SEEN-BY: 633/270
@PATH: 633/267

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