How to represent structs in text

Joe Beckenbach beckenba at cit-vax.Caltech.Edu
Thu Jul 21 11:23:04 AEST 1988


OPINION ALERT! OPINION ALERT! :-) :-)

In article <759 at vsi.UUCP> friedl at vsi.UUCP (Stephen J. Friedl) writes:
>     I am looking for opinions on how to represent structs in text.
>The two schools of thought are (a) show the full struct declaration
>and (b) show just the members.  For example, take the following two
>samples used w/o permission from intro(2):

	Showing just the members seems to indicate to me that the members
listed are definitely there, but other members might be as well which
should really not be tampered with. This is simply information-hiding
which might be better done implemented in software than by lack of reference
in the documentation.

	Showing the structure as given in the example:
>
>	struct sem_perm {
>		ushort	cuid;	/* creater user id.
>		ushort	cgid;	/* creator group id */
>		ushort	uid;	/* user id */
>		ushort	gid;	/* group id */
>		ushort	mode;	/* r/a permissions */
>	};
>
	implies that the entire structure is as it appears, and the
above text can be typed in as is as a compatible structure type.


>I'm doing some documentation reviews, and I would like very much to
>hear opinions (even just a quick yes/no) on this topic via email.

	Sorry to post instead, Steve, but I feel that this is a problem
which merits wider circulation, as ideally we *all* do documentation.
Choose whichever makes sense and implies what you need to have implied;
better yet, spell out a documentation practice, such as saying out front

"Structures displayed in their entirety have no other members implemented;
 structures displayed without surrounding braces may have additional members
 which are intentionally not mentioned."

	For system programmers and other down&dirty implementors, entire
structures should be the norm; end users deserve the watered-down partial
structure revelation normally; programmers need one or the other depending
on what level of detail they need.

		Joe Beckenbach
[We now return you to your regularly scheduled reality.... :-)]
-- 
Joe Beckenbach	beckenba at csvax.caltech.edu	Caltech 1-58, Pasadena CA 91125
Mars Observer Camera Project			Caltech Planetary Sciences Division
Live at 19200 baud. Power down young. Confuse hackers in between....  MOCvax



More information about the Comp.lang.c mailing list