delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/09/03:44:27

Message-Id: <199605090738.DAA00982@delorie.com>
Date: Thu, 09 May 96 10:32:35 LIT
From: Martynas Kunigelis <martynas DOT kunigelis AT VM DOT KTU DOT LT>
Subject: Re: Structure size
To: DJGPP mailing list <djgpp AT delorie DOT com>

On Thu, 9 May 96 03:15:00 UTC 0000 you said:
>
>P.S.:  If you are using C++, the above will not work correctly due to a bug in
>gcc.    To make it work, you have to surround your code with #pragma pack(1)
>and #pragma pack().
>
>John

Actually, the above will not even compile under G++. The docs say to append
__attribute__ ((packed)) to the end of every field, not the structure
declaration. However, your approach works with GNU C, though it is not
documented. GNU C++ does not accept it. I like your approach ( no extra
typing ) and I think G++ does not understand it due to a bug. I've reported
this to gcc bug list.

Martynas

- Raw text -


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