Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <4733@solo11.cs.vu.nl> Date: 6 Dec 89 20:55:54 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> <1989Dec2.210042.12668@twwells.com> <8129@cg-atla.UUCP> <1989Dec5.112553.24087@twwells.com> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatica, Amsterdam Lines: 21 In article <1989Dec5.112553.24087@twwells.com> bill@twwells.com (T. William Wells) writes: \... \Consider a symbol table that is used to store strings. You could \declare a member of it as: \ \ typedef struct SYMTAB { \ struct SYMTAB *sym_next; \ int sym_type; \ char *sym_text; \ } SYMTAB; \ \This has the drawback that one needs two allocates for the \structure [...] symtabptr = (SYMTAB *) malloc(sizeof(SYMTAB) + strlen(text) + 1); symtabptr->sym_text = (char *) symtabptr + sizeof(SYMTAB); strcpy(symtabptr->sym_text, text); -- `Take John Berryhill: the guy is everywhere! All because one day he typed "rn" instead of [rm]' (Richard Sexton) | maart@cs.vu.nl, uunet!mcsun!botter!maart