This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

7.1.3 violation?


When reading the following transcript, keep in mind that <string.h> was
never included. ISO 9899:1999 section 7.1.3 states that the library functions
are only reserved if their associated headers are included and 7.1.4 doesn't
list an exception. I could find no exception for strlen().

Why is this done?

Script started on Wed Sep 12 11:45:52 2001
$> cat test.c

#include <stddef.h>

size_t strlen(const char* str);

int
main()
{
   return strlen("foo");
}

$> cat test2.c

#include <stddef.h>

size_t
strlen(const char* str)
{
   return 0;
}

$> gcc -v 2>&1 | tail -1
gcc version 3.0.2 20010912 (prerelease)
$> gcc -c -Wall test.c
$> gcc -c -Wall test2.c
$> gcc test.o test2.o
$> ./a.out
$> echo $?
3
$> exit
Script done on Wed Sep 12 11:47:03 2001


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]