Mail Archives: cygwin/1996/12/20/12:07:58
beta 17.1 still shows the same behaviour when it
finds chars in structures: it aligns the structure
to the next short boundary:
You still need the __attribute__((packed))
----------------------------------------------------
#include <stdio.h>
#include <stddef.h>
typedef struct {
char ch;
short sh;
int i;
long l;
} /* __attribute__((packed)) */ test;
int main(int argc,char **argv)
{
printf("ch @ %d\n"
"sh @ %d\n"
"i @ %d\n"
"l @ %d\n",
offsetof(test,ch),
offsetof(test,sh),
offsetof(test,i),
offsetof(test,l));
}
-------------------------------------
ch @ 0
sh @ 2
i @ 4
l @ 8
--
+--------------------------------------------------------+
| #### Pedro Andres Aranda Gutierrez |
| #### |
| #### Telefonica I+D; Network Interconnection Div. |
| ==== C./ Emilio Vargas, 6 E-28043 Madrid, Spain |
| ==== e-mail : paag AT tid DOT es |
| ==== Tlf 34-1-337 47 02 FAX 34-1-337 45 02 |
+--------------------------------------------------------+
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -