🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1500

Size of structure containing char fields

#1500
From: Bruce Szablak
Date: Tue, 17 Jul 1990 14:29
14 lines
803 bytes
Given a structure that contains only char fields (possibly unsigned):

	struct example1 { char a, b, c; };

is ANSI restrictive enough [;-)] to force sizeof(example1) to be 3?

Is anyone aware of existing compilers for which this wouldn't be true?

Is there a portability problem with the following structure where the
array is intended to support a variable length array?

	struct example2 { char a, b, c[1]; };

Thanks in advance.
Technical Details
Message-ID: <1030@lzaz.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!lzaz!bds

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!lzaz!bds
From: bds@lzaz.ATT.COM (Bruce Szablak)
Newsgroups: comp.std.c,comp.lang.c
Subject: Size of structure containing char fields
Message-ID: <1030@lzaz.ATT.COM>
Date: 17 Jul 90 14:29:50 GMT
Organization: AT&T BL Middletown/Lincroft NJ USA
Lines: 14