| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f |
| Date: | Sun, 02 May 2004 20:30:16 +0200 |
| From: | "Eli Zaretskii" <eliz AT gnu DOT org> |
| Sender: | halo1 AT zahav DOT net DOT il |
| To: | djgpp-workers AT delorie DOT com |
| Message-Id: | <9178-Sun02May2004203015+0300-eliz@gnu.org> |
| X-Mailer: | emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 |
| In-reply-to: | <409508C6.1000002@phekda.gotadsl.co.uk> (message from Richard |
| Dawe on Sun, 02 May 2004 15:42:14 +0100) | |
| Subject: | Re: pragma pack in dir.h |
| References: | <8011-Sat01May2004205607+0300-eliz AT gnu DOT org> <409508C6 DOT 1000002 AT phekda DOT gotadsl DOT co DOT uk> |
| Reply-To: | djgpp-workers AT delorie DOT com |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp-workers AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
> Date: Sun, 02 May 2004 15:42:14 +0100
> From: Richard Dawe <rich AT phekda DOT gotadsl DOT co DOT uk>
>
> > <dir.h> has this:
> >
> > /* This is for g++ 2.7.2 and below */
> > #pragma pack(1)
> >
> > struct ffblk {
> > char lfn_magic[6] __attribute__((packed)); /* LFN */
> > short lfn_handle __attribute__((packed)); /* LFN */
> > unsigned short lfn_ctime __attribute__((packed)); /* LFN */
> > unsigned short lfn_cdate __attribute__((packed)); /* LFN */
> > unsigned short lfn_atime __attribute__((packed)); /* LFN */
> [...]
> How about switching from a pragma to using __attribute__((packed))?
Look above we use both "#pragma pack" _and_ __attribute__((packed)).
The reason for the pragma is that g++ 2.7.2 and earlier had a bug in
the C++ compiler whereby __attribute__((packed)) was not honored in
C++ programs.
My suggestion boils down to using "#pragma pack" only for those old
compilers.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |