www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/08/01:16:48

Date: Mon, 8 Jul 1996 08:12:15 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Alaric B. Williams" <alaric AT abwillms DOT demon DOT co DOT uk>
Cc: djgpp AT delorie DOT com
Subject: Re: [_dos_]find{first|next} problem!
In-Reply-To: <836767569.26385.0@abwillms.demon.co.uk>
Message-Id: <Pine.SUN.3.91.960708080921.28866B-100000@is>
Mime-Version: 1.0

On Sun, 7 Jul 1996, Alaric B. Williams wrote:

> It seems to be a structure packing problem... the ff.c in djtst claims
> that the offset of ff_name is 30; but the SAME test in my code returns
> 32. Why is the packing changing? I compile both sources with the same
> command line!
> 
> Further examination shows that the fact that my file is a .cc and the
> ff.c file is a .c matters. Why does the packing change????? they both
> use the same include file dir.h, which lists the struct as being fully
> packed!

This is a known bug in GCC 2.7.2: the C++ compiler doesn't pack structs.  
To work around, surround the declaration of the struct that needs to be 
packed with these pragma's:

#pragma pack(1)
struct ...
...
...
#pragma pack()

- Raw text -


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