🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9561

Re: Block Initialization; structs and sizeof

#9561
From: Mark Brader
Date: Wed, 15 Oct 1986 19:14
29 lines
1903 bytes
Distribution:

I wrote:
>	struct str {int i; char c;} arr[2], sca;
>	char buf;
> The most recent ANSI draft that I've examined specifies that if sizeof is
> applied to a structure type, the result is the size of such a structure
> including any trailing padding that would be necessary in an array of
> such structures. ...

> However, the scalar struct sca is not required to have [the] padding.
> ... Thus some compilers may decide to economize
> on storage and place another variable, say buf, [where it would be] ...

According to mail from Larry Rosler, this has been fixed, and the current
draft reads:

# There may also be unnamed padding at the end of a structure,
# as necessary to achieve the appropriate alignment WERE the
# structure to be a member of an array.  [Emphasis added]

He has suggested that the definition of sizeof be simplified to remove
the "that would be necessary..." part, which is now redundant.

Mark Brader, utzoo!dciem!msb
	"You take the bottle out of the box, take the cotton out of the
	 bottle ... and if they'd just used the box and not used the bottle
	 ... look at this, all these pills would've fitted into the box and
	 they'd have had room for 3 times as much cotton!"   -- Andy Rooney
Technical Details
Message-ID: <1980@dciem.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!dciem!msb
References: <586@calma.UUCP> <1971@dciem.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site dciem.UUCP
Path: arc1-ca.pugleaf.net!utzoo!dciem!msb
From: msb@dciem.UUCP (Mark Brader)
Newsgroups: net.lang.c
Subject: Re: Block Initialization; structs and sizeof
Message-ID: <1980@dciem.UUCP>
Date: Wed, 15-Oct-86 15:14:36 EDT
Article-I.D.: dciem.1980
Posted: Wed Oct 15 15:14:36 1986
Date-Received: Wed, 15-Oct-86 17:14:09 EDT
References: <586@calma.UUCP> <1971@dciem.UUCP>
Reply-To: msb@dciem.UUCP (Mark Brader)
Organization: NTT Systems Inc., c/o DCIEM, Toronto
Lines: 27
Summary: ANSI now *does* require trailing padding on scalar structs