TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: LEE KIRBY
from: ADAM MAJER
date: 1998-01-05 16:25:00
subject: Extra bytes

LK> LK>> The way I count, this structure should be only 190 bytes, but if I 
o
LK> LK>> a sizeof( fMsg), it reports 192!
LK> > I added it all together, and the structure IS 192.
LK>Hmm...I still get 190.  I believe the solution is that the compiler 
allocate
LK>a chunk of memory that is divisible by 2 for efficiency's sake.
LK>       struct header {
LK>036      char from[ 36 ];
        . . .
LK>002      ushort nextReply; LK>       };
LK>===
LK>190
If you have paragraph alignments and stuff, then the compier allocates
192 bytes 'cause in binary the numbers are:
        190 - 1011 1110 - 0xBE
        192 - 1100 0000 - 0xC0
If you divide by 16 bytes (paragraph) you get:
        190 - 11.875   <- not an even paragraph
        192 - 12       <- even paragraph - faster and easier access
--- FMail 0.92
 # SLMR 2.1 # Unable to locate Coffee -- Operator Halted!
---------------
* Origin: The Programmer's Oasis on FIDONET! (1:348/203)

SOURCE: echomail via exec-pc

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