Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!rtech!llama!daveb From: daveb@llama.rtech.UUCP (Dave Brower) Newsgroups: comp.lang.c Subject: Re: How to represent structs in text Message-ID: <2340@rtech.rtech.com> Date: 25 Jul 88 05:29:25 GMT References: <759@vsi.UUCP> <7351@cit-vax.Caltech.Edu> Sender: news@rtech.rtech.com Reply-To: daveb@llama.UUCP (Dave Brower) Organization: Relational Technology, Inc. Alameda, CA Lines: 54 In <7351@cit-vax.Caltech.Edu> beckenba@cit-vax.UUCP (Joe Beckenbach) writes: >OPINION ALERT! OPINION ALERT! :-) :-) > >In article <759@vsi.UUCP> friedl@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. I am inclined to show the structure as it would be declared in real C, with elipses indicating the (possible) presence of members with which the user shouldn't muck. This is from the splay tree library man page I submitted to comp.unix: .PP The SPTREE structure declared in sptree.h should only be handled indirectly. A pointer to an SPTREE is returned by .I spinit and should be handed blindly to other access functions. .PP The nodes in a splay tree are defined by the following structure, declared in sptree.h. .PP .nf typedef struct _spblk SPBLK; typedef struct _spblk { . . . char *key; char *data; char *datb; }; I find exclusively textual descriptions opaque, and it's infuriating to run across C that appears to be complete, but isn't. There is a fundamental problem with C here, which is the lack of a private/public distinction. C++ handles this much more nicely. -dB "Ready when you are Raoul!" {amdahl, cpsc6a, mtxinu, sun, hoptoad}!rtech!daveb daveb@rtech.com <- FINALLY!