B
BartC
Never thought I'd be asking about this, but it's giving me some trouble!
I want to use a declaration that looks like this:
typedef unsigned char* ichar;
int main(int nparams,ichar (*params)[]) {
int i;
for (i=0; i<nparams; ++i)
printf("%d: %s\n",i,(*params));
}
(Why? Because this will be the output of a code generator.)
This works perfectly well with four different C compilers. But Clang doesn't
like it: it insists the params type must be char** (and it can't be signed
nor unsigned either, just unspecified, however the latter only gives a
warning; as I have it above, it is an error).
Is there in fact something wrong with the way I'm doing it?
One way to get around it, seems to be to move the main function, which
appears to be special to Clang, outside of the non-C source language.
Another is to make a special case when compiling a function called 'main',
and bodge the output that way. But I don't particularly want to do this, and
it's just pandering to this very fussy compiler.
I want to use a declaration that looks like this:
typedef unsigned char* ichar;
int main(int nparams,ichar (*params)[]) {
int i;
for (i=0; i<nparams; ++i)
printf("%d: %s\n",i,(*params));
}
(Why? Because this will be the output of a code generator.)
This works perfectly well with four different C compilers. But Clang doesn't
like it: it insists the params type must be char** (and it can't be signed
nor unsigned either, just unspecified, however the latter only gives a
warning; as I have it above, it is an error).
Is there in fact something wrong with the way I'm doing it?
One way to get around it, seems to be to move the main function, which
appears to be special to Clang, outside of the non-C source language.
Another is to make a special case when compiling a function called 'main',
and bodge the output that way. But I don't particularly want to do this, and
it's just pandering to this very fussy compiler.