From: Russ Cox <rsc@swtch.com>
To: fernanbolando@mailc.net,
Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] zero length arrays in gcc
Date: Sun, 27 Sep 2009 10:01:56 -0700 [thread overview]
Message-ID: <dd6fe68a0909271001u15a294a2v62c591015ed50768@mail.gmail.com> (raw)
In-Reply-To: <1d5d51400909250114s2f547149ka58a049630a88097@mail.gmail.com>
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
next prev parent reply other threads:[~2009-09-27 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-22 18:49 Fernan Bolando
2009-09-22 19:19 ` Bakul Shah
2009-09-25 8:14 ` Fernan Bolando
2009-09-27 17:01 ` Russ Cox [this message]
[not found] <<1d5d51400909221149u32faccd7ue23a538afa523a23@mail.gmail.com>
2009-09-22 18:58 ` erik quanstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd6fe68a0909271001u15a294a2v62c591015ed50768@mail.gmail.com \
--to=rsc@swtch.com \
--cc=9fans@9fans.net \
--cc=fernanbolando@mailc.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).