M
mathieu
Hi there,
I am using the following piece of code (*) to determine whether or
not a particular function exist. It is working fine most of the time,
but I recently got a case where it shows limitation: builtins
functions. For instance compiling it with a recent gcc version leads
to:
$ gcc -DCHECK_FUNCTION_EXISTS=strncasecmp -o CheckFunctionExists.o -
c CheckFunctionExists.c
CheckFunctionExists.c:3: warning: conflicting types for built-in
function ‘strncasecmp’
Any suggestion on a better way to do that ?
Thanks!
-Mathieu
(*)
#ifdef CHECK_FUNCTION_EXISTS
char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(){
int ac;
char*av[];
#else
int main(int ac, char*av[]){
#endif
CHECK_FUNCTION_EXISTS();
if(ac > 1000)
{
return *av[0];
}
return 0;
}
#else /* CHECK_FUNCTION_EXISTS */
# error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */
I am using the following piece of code (*) to determine whether or
not a particular function exist. It is working fine most of the time,
but I recently got a case where it shows limitation: builtins
functions. For instance compiling it with a recent gcc version leads
to:
$ gcc -DCHECK_FUNCTION_EXISTS=strncasecmp -o CheckFunctionExists.o -
c CheckFunctionExists.c
CheckFunctionExists.c:3: warning: conflicting types for built-in
function ‘strncasecmp’
Any suggestion on a better way to do that ?
Thanks!
-Mathieu
(*)
#ifdef CHECK_FUNCTION_EXISTS
char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(){
int ac;
char*av[];
#else
int main(int ac, char*av[]){
#endif
CHECK_FUNCTION_EXISTS();
if(ac > 1000)
{
return *av[0];
}
return 0;
}
#else /* CHECK_FUNCTION_EXISTS */
# error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */