strsignal.c implementation

Eric Blake
Tue May 11 20:44:00 GMT 2010

On 05/11/2010 02:41 PM, Joel Sherrill wrote:
>>   I changed the signature to be char * instead of const
>> char * as I found the online docs for the function (including glibc)
>> were all sans-const.

Indeed, that is what POSIX requires.

> Hmm.. there was a paragraph in strerror about this implementation
> using constant strings and do not corrupt them.  I wonder if
> now that it is not returning a const char * if that same text needs
> to be there.

POSIX states:
The string pointed to shall not be modified by the application, but may
be overwritten by a subsequent call to strsignal() or setlocale().

The only reason that the return value is not const char * is because
strsignal predates C89 const.  But applications should treat it as const
char anyways.

Eric Blake    +1-801-349-2682
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Newlib mailing list