delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/08/01:24:40

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607080518.AA014283122@relay1.geis.com>
Date: Mon, 8 Jul 96 05:08:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: [_dos_]find{first|next} pr

Reply to message 2927413    from ALARIC AT ABWILL on 07/07/96  3:27PM


>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 - it does not pack structures correctly when
compiling C++.  The easiest way to work around this is to surround dir.h
with the following:

#pragma pack(1)
#include <dir.h>
#pragma pack()

I suppose you could also edit dir.h to insert the pragma lines in the
#ifdef __cplusplus sections.

This question is going to be in the next release of the FAQ, which is coming
RSN.  :)

John

- Raw text -


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