From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <1d5d51400909250114s2f547149ka58a049630a88097@mail.gmail.com> References: <1d5d51400909221149u32faccd7ue23a538afa523a23@mail.gmail.com> <20090922191954.837485B37@mail.bitblocks.com> <1d5d51400909250114s2f547149ka58a049630a88097@mail.gmail.com> Date: Sun, 27 Sep 2009 10:01:56 -0700 Message-ID: Subject: Re: [9fans] zero length arrays in gcc From: Russ Cox To: fernanbolando@mailc.net, Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Topicbox-Message-UUID: 782963ae-ead5-11e9-9d60-3106f5b1d025 Assuming there are not many of these, the easiest thing to do is fix the nhc98 code. Figure out what the field after the label is and take that address instead. Alternately, you can use a Plan 9 extension to defeat the gcc extension. Wherever it says struct Foo{ ... uchar startLabel[]; int field1; char field2; double field 3; uchar endLabel[]; ... } you can replace it with typedef struct insideFoo insideFoo; struct insideFoo { int field1 char field2; double field3; } struct Foo { ... insideFoo; ... } and then when it says something like p = x.startLabel; q = x.endLabel; memmove(&data, &x.startLabel, x.endLabel - x.startLabel); you can write p = (char*)&x.insideFoo; q = (char*)(&x.insideFoo+1); memmove(&data, &x.insideFoo, sizeof x.insideFoo); Russ