www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/03/07:13:11

Date: Mon, 3 Jun 1996 14:08:19 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jorrit Tyberghein <Jorrit DOT Tyberghein AT uz DOT kuleuven DOT ac DOT be>
Cc: DJGPP AT delorie DOT com
Subject: Re: Bug in findfirst/findnext???
In-Reply-To: <31B2997B.4A7D@uz.kuleuven.ac.be>
Message-Id: <Pine.SUN.3.91.960603135602.21344N-100000@is>
Mime-Version: 1.0

On Mon, 3 Jun 1996, Jorrit Tyberghein wrote:

> But when I compile this program with 'gcc -x c++ -o test test.c'
> (so I'm using the C++ compiler) it doesn't work correctly anymore.
> In the output the two first characters are missing. I have to change
> the printf line to 'printf ("%s\n", ff.fa_name-2);' to get the
> correct output.

This is a known bug in GCC 2.7.2: the C++ compiler doesn't pack 
structures correctly.  A work-around is to surround the struct ff_blk 
declaration on <dir.h> with these:

#ifdef __cplusplus
#pragma pack(1)
#endif
.
.
.
#ifdef __cplusplus
#pragma pack()
#endif

- Raw text -


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