I have a program that compiles fine with QNX 6.1.0 but doesn’t work with QNX
6.1.0 + patch A. The compiler gives a warning about the line:
#pragma pack(2)
I presume that the definition of pragma has changed in patch A. Can anyone
tell me what this line should be - I am trying to align data to two byte
boundaries.
Also where can I find information on this sort of compiler specific issue
for the latest release? I could not find anything searching the help docs
or QNX website.
I believe this was answered in the tools newsgroup originally
(qdn.public.qnxrtp.os isn’t the best place for a compiler question) but I’ve
posted the answer below.
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>
From the gcc info docs:
Specifying Attributes of Variables
The keyword __attribute__' allows you to specify special attributes of variables or structure fields. This keyword is followed by an attribute specification inside double parentheses. Eight attributes are currently defined for variables: aligned’, mode', nocommon’, packed', section’, transparent_union', unused’, and `weak’. Other
attributes are available for functions (*note Function Attributes: and
for types (*note Type Attributes::).
…
packed' The packed’ attribute specifies that a variable or structure field
should have the smallest possible alignment–one byte for a
variable, and one bit for a field, unless you specify a larger
value with the `aligned’ attribute.
Here is a structure in which the field x' is packed, so that it immediately follows a’:
struct foo
{
char a;
int x[2] attribute ((packed));
};
I have a program that compiles fine with QNX 6.1.0 but doesn’t work with
QNX
6.1.0 + patch A. The compiler gives a warning about the line:
#pragma pack(2)
I presume that the definition of pragma has changed in patch A. Can
anyone
tell me what this line should be - I am trying to align data to two byte
boundaries.
Also where can I find information on this sort of compiler specific issue
for the latest release? I could not find anything searching the help docs
or QNX website.