The value of "sizeof(struct dhkey)" will be different after the change.
-Alfred Deepak Bhatia wrote: > Hi, > > In the Solaris source code, the following syntax is used for example > > struct dhkey { > u_short length; /* Length in bytes */ > u_char key[1]; /* Binary data; allocated to correct length */ > }; > > May be you have to change it to 1 :-) > > Regards > > Deepak Bhatia > > -----Original Message----- > From: tools-linking-bounces at opensolaris.org > [mailto:tools-linking-bounces at opensolaris.org]On Behalf Of Alfred Peng > Sent: Tuesday, March 13, 2007 3:16 PM > To: tools-linking at opensolaris.org > Subject: [tools-linking] Problem for array with 0 element > > > Hi guys, > > When porting an application to Solaris, I met a problem for array > with 0 element. > > An array with 0 element can be used in class/struct declaration. > It's like a place holder to add more memory at the end of the > class/struct instance in the future, to make the size of the > class/struct variable. For example: > > struct { > uint32 length; > uint16 buffer[0]; > } a; > > It seems that the sun cc doesn't support this. When I build it, the > error message shows "Error: An array must have at least one element.". > And it works fine with gcc. Is this an extension feature for gcc? Is > there any workaround for this with sun cc? > > Thanks, > -Alfred > _______________________________________________ > tools-linking mailing list > tools-linking at opensolaris.org > > > _______________________________________________ > tools-linking mailing list > tools-linking at opensolaris.org >