delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/02/20:01:32

From: yorka AT dlc DOT fi (aYk)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Size of a struct is not correct
Date: Thu, 02 Jul 1998 23:54:12 GMT
Organization: Majik
Lines: 34
Message-ID: <359d1c56.1221191@news.dlc.fi>
References: <01bda5a5$ce48b420$0100a8c0 AT dismuntel DOT ctv DOT es>
NNTP-Posting-Host: cccxcvii.kdyn.saunalahti.fi
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 2 Jul 1998 12:40:18 +0200, "Javier Calleja"
<dismuntel AT apdo DOT com> wrote:

>
>Hi world
>
>  I have built the following struct:
>
>  struct
>  {
>    char one;
>    short two,three;
>    long  four
>  } foo;
>
>    But when I do sizeof of this struct, the result is wrong (it says the
>struct has 12 bytes).

struct
{
 char one 		__attribute__ ((packed));
 short two, three	__attribute__ ((packed));
 long four		__attribute__ ((packed));
} foo;

- aYk -

| Atte "Yorkaturr" Koivula 	- aYk -	 |
| -------------------------------------- |
| God of Evil | yorka AT dlc DOT fi             |
| Coder       |	yorka AT newbies DOT net        |
| Graphician  |	yorkaturr AT majik DOT netti DOT fi |
| -------------------------------------- |
| Majik MURPE  -  http://majik.netti.fi  |

- Raw text -


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