Indefinite-length array as member of struct: how?
Henry Spencer
henry at utzoo.uucp
Sat Jul 8 01:50:55 AEST 1989
In article <7360 at c3pe.UUCP> charles at c3pe.UUCP (Charles Green) writes:
>I have an application where I'm building and manipulating a stack of
>variable-length strings...
>
>struct node {
> struct node* next;
> char string[];
>} *nodeptr;
I believe I recall Dennis Ritchie once characterizing this sort of thing
as "unwarranted chumminess with the compiler"! I suspect that a close
reading of the draft C standard says you can get away with it, but it's
still cheating in at least a small way.
If you want to shut your compiler up, try making that "[1]".
--
$10 million equals 18 PM | Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list