www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/04/19:53:28

From: roland DOT nilsson AT communique DOT se (Roland Nilsson)
Newsgroups: comp.os.msdos.djgpp
Subject: __attribute__((packed)) on types
Date: 4 Jan 1997 23:46:28 GMT
Organization: -+- Private -+-
Lines: 31
Message-ID: <5amq4k$dvk@news.luth.se>
NNTP-Posting-Host: x21.communique.se
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Here's another problem.

I have not been able to get __attribute__((packed)) to work properly
for types. Source example:

struct foo
{
	char a;
	long b;
} __attribute__((packed));

This will not compile - gcc thinks I forgot the ending ';', and it
never recognizes the attribute. The error message:

foo.cc:5: semicolon missing after declaration of 'foo'

I guess that djgpp has simply not implemented attributes for
types, but I'm not sure. Here's an extract of the GNU gcc doc:

"packed:
 This attribute, attached to an enum, struct, or union type definition, 
 specified that the minimum required memory be used to represent the 
 type. Specifying this attribute for struct and union types is equivalent 
 to specifying the packed attribute on each of the structure or union 
 members..."

Is this true for djgpp? Have I missed something regarding the
syntax?

 -R-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019