www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/21/09:32:27

From: massarin AT alpha3 DOT cram DOT enel DOT it
Newsgroups: comp.os.msdos.djgpp
Subject: Struct with array. HELP
Date: 21 Apr 1998 13:13:14 GMT
Organization: ENEL Ricerca PEA
Lines: 29
Distribution: inet
Message-ID: <6hi61a$avd1@willy.cra.enel.it>
Reply-To: massarin AT alpha3 DOT cram DOT enel DOT it
NNTP-Posting-Host: alpha3.cram.enel.it
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi all.

My problem is that when I declare a struct like:

struct a {

  char b[n];
  int  c;
  .
  .
  .      }

if n (number of char in array) is not a multiple of 4
the array is enlarged to fit a 4' multiple, 

n=32 int c is 32 byte from start of struct
n=33 int c is 36 byte from start of struct

I've verified it with GDB and doing sizeof(struct a).

Does anyone know how to make the struct, and the array, of
the proper size ,apart from doing the struct as an array ?
Is it a bug of compiler ?

Thanks.

ps. Please answer by newsgroup .

- Raw text -


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