This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strsignal.c implementation


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   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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