Article View: comp.std.c
Article #4273Re: Variable length struct hack
From: Steve Summit
Date: Wed, 25 Oct 1995 20:33
Date: Wed, 25 Oct 1995 20:33
24 lines
1423 bytes
1423 bytes
In article <463egk$jbb@nntp.Stanford.EDU>, becker@Xenon.Stanford.EDU writes: > From the FAQ 9.7: > To be on the safe side, it may be preferable to declare the > variable-size element very large, rather than very small; in the case > of the above example: > char name[MAXSIZE]; > where MAXSIZE is larger than any name which will be stored. (The trick > so modified is said to be in conformance with the Standard.) > > I seem to remember hearing recently that even this modification is > not actually in conformance with the Standard, but I can't remember > why. Chris and Tanmoy have discussed this at length, but I should point out that *I've* now heard that the modification probably isn't conforming, either; recent versions of the FAQ list (where the above question is now numbered 2.6) read ...where MAXSIZE is larger than any name which will be stored. However, it looks like this technique is disallowed by a strict interpretation of the Standard as well. Steve Summit scs@eskimo.com
Technical Details
Message-ID:
<DH0uG2.Ft@eskimo.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!eskimo!scsReferences:
<463egk$jbb@nntp.Stanford.EDU>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!in2.uu.net!eskimo!scs From: scs@eskimo.com (Steve Summit) Subject: Re: Variable length struct hack X-Nntp-Posting-Host: eskimo.com Message-ID: <DH0uG2.Ft@eskimo.com> Sender: news@eskimo.com (News User Id) Organization: only when absolutely necessary References: <463egk$jbb@nntp.Stanford.EDU> Date: Wed, 25 Oct 1995 20:33:38 GMT