[cffi-devel] Empty structures [was: Re: <sigh> libtest.dll anyone?]

Luis Oliveira luismbo at gmail.com
Thu Sep 15 01:33:16 UTC 2005


Kenny Tilton <ktilton at nyc.rr.com> writes:
> VC++ considers:
>
> struct empty_struct {};
>
> ...to be an error. Anyone got libtest.dll? Or should I break down and
> try Cygwin? Is that what other folks do? Maybe I missed a switch for
> the C++ compiler?

For the record, I just tried compiling libtest with Visual C++ 2003 and
it fails too. It seems that empty structures are not standard C (it's
valid C++ though).

Which makes me wonder how we should allocate empty structures, since the
C and C++ ABI's differ in this aspect (like Rayiner mentioned). Since
it's not standard C, but it is standard C++ perhaps we should make empty
structures have size and alignment = 1 byte.

So for now I'm commenting out this test STRUCT.ALIGNMENT.5 so that
libtest is compilable with MSVC++.

Is there any useful application of empty structs anyway?

-- 
Luis Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=pt




More information about the cffi-devel mailing list