Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

implicit declaration warning not produced using C compiler

$
0
0

Compiling the below code in gcc (gcc -Wall foo.c) yields the following warning message:

foo.c: In function 'main':
foo.c:9: warning: implicit declaration of function 'strlen'
foo.c:9: warning: incompatible implicit declaration of built-in function 'strlen'

When I compile using Intel C++ compiler (icpc -Wall foo.c)  I get the below error message:

foo.c(9): error: identifier "strlen" is undefined
    len = strlen(foo);

When I compile using Intel C compiler (icc -Wall foo.c) no warning messages are displayed.  Why is this the case?

 

#include <stdlib.h>
int main (int argc, char **argv)
{
  char foo[] = "abcd";
  int len;

  len = strlen(foo);
  return 0;
}

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>