On Mon, 05 Dec 2011 17:07:33 -0500, Steve Boyd sboydlns@gmail.com wrote:
I got an error while compiling universal.c with Visual Studio. The compiler didn't like the following line:
device_data_t devdata = {0};
in dowork().
I changed it to:
device_data_t devdata; memchr(&devdata, 0, sizeof(devdata));
and now everything compiles cleanly.
Thought you should know.
This is standard C syntax to initialize all struct fields to zero. You can find a nice explanation here:
http://ex-parrot.com/~chris/random/initialise.html
But it's very possible the msvc compiler doesn't support it. Getting the msvc compiler to work isn't straightforward. I use a few C99 features, which are not supported at all. The workaround I used is to build the C code as C++. Note that the msvc project file is provided as a convenience, but it's not maintained equally well as the autotools build system.
The recommended build system on windows is mingw, but with some extra (manual) effort msvc should work too.