delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/01/19:17:43

Message-ID: <354A552C.5911EFD9@ipass.net>
From: Terry <iceman AT ipass DOT net>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with integer declaration?
References: <354AB827 DOT 8EE19C9D AT mailexcite DOT com>
Lines: 11
Date: Fri, 01 May 1998 23:09:40 GMT
NNTP-Posting-Host: ts7-208-ppp.ipass.net
NNTP-Posting-Date: Fri, 01 May 1998 19:09:40 EDT
Organization: iPass.Net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I think it has something to do with alignment.  For example,

typedef struct {
	char abc[1];
        int i;
	char def[1];
} teststruct;

The size returned here is 12 on my linux system (not 6).  Here,
the characters "abc" and "def" take 4 bytes rather than 1.

I think there is an option for gcc that will align on byte boundaries.
Sorry I don't remember it off hand.

Hope this helps.

Terry

- Raw text -


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