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.
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.
This is standard C syntax to initialize all struct fields to zero. You can
find a nice explanation here:
I've been coding in C for a long time and never came across that syntax before. Learn something new every day.
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.
Overall, I'm not having too many problems with msvc and it is a lot less hassle than installing mingw just for this.