"expandable" structs with last element declared using [1]
    Wm E Davidsen Jr 
    davidsen at crdos1.crd.ge.COM
       
    Fri Dec 22 01:31:31 AEST 1989
    
    
  
In article <4379 at cuuxb.ATT.COM> mmengel at cuuxb.UUCP (Marc W. Mengel) writes:
| Gee guys, you *told* the compiler that foo->baz only has one
| character in it; of *course* it's wrong to reference 
| foo->baz[1].  
  Good point. Since this is a fairly common practice in C, I think there
would be room in a future version of the standard for a solution. I
*suggest* that it might be to allow the zero length declaration 
(int x[0]) as an explicit way of specifying just this type of struct
growth. It would, of course, disable subscript checking on that
particular array.
  I can't think of any use for it other than as the last element of a
struct, but there might be such. Any comments on the implications of
allowing this? I don't see a conflict with the existing standard, and
the practice of expanding a struct is certainly common, if not perfectly
portable under the ANSI rules.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon
    
    
More information about the Comp.std.c
mailing list