This is the mail archive of the
mailing list for the newlib project.
strnlen, strict ansi, newlib vs glibc
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Thu, 14 Aug 2014 10:27:53 -0500
- Subject: strnlen, strict ansi, newlib vs glibc
- Authentication-results: sourceware.org; auth=none
I have some native C++ code that I developed on CentOS and it
has no warnings. Someone moved it to Cygwin and reported warnings
for strnlen() not being prototyped. I investigated and the program did
include string.h. I tried RTEMS tools and got the same as Cygwin
since we have the same string.h from newlib.
Investigating this, it appears that strnlen() is protected by
__STRICT_ANSI__ on newlib and __USE_XOPEN2K8 on Linux.
Command: g++ -Wall -std=c++0x -c strtest.cc
This program is enough to reproduce the issue:
// size_t strnlen( const char *, size_t );
size_t f( const char *str )
return strnlen( str, 1000 );
What do you all think?
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985