Am 25.02.2013 um 16:12 hat Eric Blake geschrieben: > On 02/24/2013 11:37 PM, Dietmar Maurer wrote: > > I tried to do that, but it seems that gcc does not support sizeof in > > preprocessor conditionals, > > so I added a runtime check in vma_writer_create(). > > Then you've never written a compile-time assertion, have you :) No > preprocessor magic is needed. > > > > > Do you have an example how I can add a compile-time assertion that this > > header is a fixed size? > > struct foo { ... }; > struct verify_foo_size { > char dummy[sizeof(struct foo) == 256 ? 1 : -1]; > };
Don't open-code this. We have QEMU_BUILD_BUG_ON(). Kevin