www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/26/08:19:43

From: Olav Kindt <kindt AT cmr DOT no>
Newsgroups: comp.os.msdos.djgpp
Subject: C++ packed structs..
Date: Wed, 26 Feb 1997 13:01:58 +0100
Organization: Christian Michelsens Institutt
Lines: 35
Message-ID: <33142636.C9D@cmr.no>
NNTP-Posting-Host: io.cmr.no
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi all,  

I just read from the faq 22.9 about packing struct.

I have a clarification question regarding that:

The faq says that a struct like

	struct {
		char name[7];
		unsigned long offset;
		double quality;
	} __attribute__ ((packed));

will be packed correctly when compiled as C-source. Then it says that
C++ doesn't allow this, and you must declare each struct field with the
packed attribute.

Does this in effect mean this :

	struct {
		char name[7] __attribute__ ((packed));
		unsigned long offset __attribute__ ((packed));
		double quality __attribute__ ((packed));
	};


I've had some weird problems lately with my program, so
I'll really appreciate an answer to this. Thanks in advance.


-- 
Olav Kindt                              email : kindt AT cmr DOT n
Datateknologi				tlf : 55-574352	
Christian Michelsen Research AS

- Raw text -


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