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?
On 14/set/2005, at 02:21, Kenny Tilton wrote:
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?
I tested on Windows 2000 using both MSYS (similar to Cygwin) and the free MSVC++ toolkit.
I use tests/compile.bat to compile with the free MSVC++:
cl /ML /LD -D_MT /DWIN32=1 libtest.c
Kenny Tilton ktilton@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?