Mail Archives: djgpp/1996/08/31/16:04:04
Xref: | news2.mv.net comp.os.msdos.djgpp:8106
|
From: | "John M. Aldrich" <fighteer AT cs DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: strange parse error
|
Date: | Sat, 31 Aug 1996 12:13:50 -0700
|
Organization: | Three pounds of chaos and a pinch of salt
|
Lines: | 52
|
Message-ID: | <32288EEE.36A4@cs.com>
|
References: | <507s49$iaq AT loki DOT tor DOT hookup DOT net>
|
NNTP-Posting-Host: | ppp224.cs.com
|
Mime-Version: | 1.0
|
To: | Stephen Marton <istvan AT outer-net DOT com>
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Stephen Marton wrote:
>
> I wrote a header file made up of pieces of code from a tutorial on
> VESA programming. I had a lot of errors at the first compilation, but
> I fixed all of them, except the last line in this piece of code:
> ...
> short OffScreenMemSize;
> char res2[206] PACKED;
> }VBE_ModeInfo;
>
> #pragma pack()
I'd assume from this that the PACKED macro is defined incorrectly.
An extra or missing parenthesis or an extra semicolon dropped in there
can really mess things up.
Also, you should only use the #pragma pack(1)...#pragma pack() if you
are compiling C++ code; C doesn't require it. The way to do this
is to enclose the pragmas in conditionals like so:
#ifdef __cplusplus
#pragma pack(1)
#endif
..
..
..
#ifdef __cplusplus
#pragma pack()
#endif
For maximum compatibility, I would also define my PACKED macro like so:
#ifndef __cplusplus
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
You could even add a conditional to test for the gcc versions that have
the bug with C++ packing. :)
This shouldn't be causing your problem, though.
--
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W+>++ N++ o+ K? w(---) O-
M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++
h!() !r !y+()
------END GEEK CODE BLOCK------
- Raw text -