Bug#485135: libc6-dev: XSI-compliant version of strerror_r() not useable from C++
Package: libc6-dev
Version: 2.7-10
Severity: normal
Hi,
I want to use the XSI-compliant version of strerror_r(). The code below compiles
without any error using the gcc.
Trying to compile this code as C++ code using the g++ always fails because the
compiler always tries to use the GNU version of strerror_r() that returns an
char* instead of an int. Trying to define _XOPEN_SOURCE=600 does not change
anything.
I used the sample code below:
#include <string.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char **argv) {
char buf[1024] = "";
int rc = strerror_r(EINVAL, buf, sizeof(buf)-sizeof(char));
printf("%d %s\n", rc, buf);
return 0;
}
Also using the C++ includes cstring, cstdio and cerrno does not change anything.
The following C++ compilers are installed:
ii g++ 4:4.2.3-10 The GNU C++ compiler
ii g++-4.1 4.1.2-19 The GNU C++ compiler
ii g++-4.2 4.2.4-1 The GNU C++ compiler
And g++ is a link to g++-4.2.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-686-bigmem (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libc6-dev depends on:
ii libc6 2.7-10 GNU C Library: Shared libraries
ii linux-libc-dev 2.6.24-7 Linux Kernel Headers for developme
Versions of packages libc6-dev recommends:
ii gcc [c-compiler] 4:4.2.3-10 The GNU C compiler
ii gcc-4.1 [c-compiler] 4.1.2-19 The GNU C compiler
ii gcc-4.2 [c-compiler] 4.2.4-1 The GNU C compiler
-- no debconf information
Reply to: