| www.delorie.com/archives/browse.cgi | search |
| Xref: | news2.mv.net comp.os.msdos.djgpp:755 |
| From: | bradtech AT i-link DOT net (Brad Burgan) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | __alignement__ in v2b5 |
| Date: | Fri, 02 Feb 1996 19:16:04 GMT |
| Organization: | I-Link Inc |
| Lines: | 36 |
| Message-ID: | <4etntt$75b0@news.i-link.net> |
| NNTP-Posting-Host: | houston-1-16.i-link.net |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
//===beginning of file===
//
// test.cpp
//
#include <stdio.h>
struct TestStruct
{
char var1;
short var2 __attribute__ ((packed));
};
int main(void)
{
printf("sizeof(TestStruct): %i", sizeof(TestStruct));
}
// ===end of file===
Can anyone tell me why this program produces:
sizeof(TestStruct): 4
*************************************************************
Also:
Info says you can do this:
struct S
{
blah
} __attribute__ ((packed)); // <<<<< line 106
But I get a compiler error that ; is missing on line 106
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |