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

Reply via email to