[m-users.] Yet another piece for the posix library: strerror(3)

Julien Fischer jfischer at opturion.com
Mon Oct 28 17:21:30 AEDT 2019



On Mon, 28 Oct 2019, Volker Wysk wrote:

> Am Montag, den 28.10.2019, 16:06 +1100 schrieb Julien Fischer:
>> On Sun, 27 Oct 2019, Volker Wysk wrote:
>> 
>> > I've extended the posix library again, this time with the
>> > strerror(3)
>> > call. I had to modify posix.m in order to do it.
>> 
>> That's not referentially transparent as the error message returned
>> will
>> be affected by the current locale setting.  This can be fixed by
>> making
>> the interface into:
>>
>>     :- pred strerror(posix.error::in, string::out, io::di, io::uo) is
>> det.
>
> I thought that it might depend on the locale, but the locale doesn't
> change, and therefore it is referentially transparent. But there might
> be the slight possibility that the LC_MESSAGES environment variable is
> changed during runtime...

Nevermind environment variables, there is a slight possibility that
setlocale() might be called from within the program.

Julien.


More information about the users mailing list