delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/12/07:57:11

From: Michael Uplawski <uplawski AT sulla DOT franken DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Generous SIZEOF
Date: Sun, 12 Sep 1999 13:21:24 +0200
Organization: KNF e.V.
Message-ID: <SorbN=5UcIH2MGzMvvfmX1yTuevV@4ax.com>
NNTP-Posting-Host: sulla.franken.de
Mime-Version: 1.0
X-Trace: chico.franken.de 937135354 95208 193.175.24.189 (12 Sep 1999 11:22:33 GMT)
X-Complaints-To: newsmaster AT franken DOT de
NNTP-Posting-Date: 12 Sep 1999 11:22:33 GMT
X-Newsreader: Forte Agent 1.6/32.525
X-No-Archive: yes
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi.

Why is djgpp (or any compiler) adding 3 bytes of memory, if the sum of
memory used by a struct is 205 Bytes?
Okay, as my English is not good enough to describe it completely, here
is my example:
-------------------
#define MAX	450

struct CD
{
    char Title[100];
    char Interpreter[100];
    int Year;
    char Live;
} All[MAX];
--------------------

The sum of memory used by each variable is 205 Bytes on a
32bit-system, right? If I use SIZEOF with a pointer to an element of
the array (or whatever the correct terminology might be, my K&R is in
German), 208 Bytes are reported.

TIA,

Michael.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019