Movatterモバイル変換
[0]ホーム
This is the mail archive of thebinutils@sources.redhat.commailing list for thebinutils project.
Re: Does a zero-sized object in BSS go away?
Geoff Keating wrote:[snip]> > > ISO C programs can't create zero-size objects, but you can do it in> > > GCC.> > > > > > I think there's no way to tell if an object, which the program thinks> > > is zero-size, actually has non-zero size. So you could just make the> > > common symbols have size 1 if the user asks for size 0...> > > > This may break pointer comparisions. (Not that I knew of a good reason> > to do this).> > I don't see how this could break pointer comparisons.Gcc allows to take the address of a zero-sized object:struct a {int b[0];int c[0];} d;int main(void){return &d.b == &d.c;}> You can't meaningfully do them with zero-size objects anyway...It's probably (hopefully :-) only a theoretical point and not apractical issue.Thiemo
[8]ページ先頭