I am trying to get a protobuf-c example compiled using the C90 compiler (MS VS2012).
There are two C99-specific things in the protobuf-c source code that can be easily changed to be compatible with C90, i.e. declaring a variable in the middle of the scope ( not allowed in C90 ) and creating structures through . -syntax (for example, some_struct_type name = {.a=1,.b=2} ).
Now I am stuck in one compilation error. The corresponding line in the protobuf-cc source file reads:
void *array = *(void **) member + siz * (*p_n);
Where member defined as void * and p_n as size_t * . And the corresponding error
error C2036: 'void *' : unknown size
Note that this is valid for protobuf-c version 1.0.1 (see the corresponding source code , line 2404). This line was changed in version 1.0.2 to
void *array = *(char **) member + siz * (*p_n);
with this comment . Thus, changing the line eliminates a compilation error.
My questions:
- I would like to understand this line of code.
- Can I upgrade to version
*(char **) ? - What is an error message telling me?
(For some other reason, I want to stick with protobuf-c 1.0.1)
georg source share