I have a problem with defining an array of const void * pointers in ths code snippet - Visual C++ complains about whatever combination I try:
void *call_func_cdecl(void *func, const void *const *args, int nargs);
void vlogprintf(const char *format, va_list va) {
int nargs;
void **args;
args = malloc(...);
args[0] = format;
// fill the rest...
call_func_cdecl((void*)logprintf, args, nargs);
free(args);
}
As you know free takes a void * so the array itself should not be constant but its elements should be becase format is a const void * and it's an element of args.
So far I tried these:
const void **argsGot
warning C4090: 'function' : different 'const' qualifiersat thefree(args)linevoid const **argsSame as above
void *const *argsGot
error C2166: l-value specifies const objectat theargs[0] = formatlinevoid **const argsSame as above