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

Volker Wysk post at volker-wysk.de
Mon Oct 28 17:47:50 AEDT 2019


Am Montag, den 28.10.2019, 17:27 +1100 schrieb Julien Fischer:
> 
> On Mon, 28 Oct 2019, Volker Wysk wrote:
> 
> > Am Montag, den 28.10.2019, 16:12 +1100 schrieb Peter Wang:
> > > On Mon, 28 Oct 2019 16:06:47 +1100 (AEDT), Julien Fischer <
> > > jfischer at opturion.com> wrote:
> > > > Hi Volker
> > > > 
> > > > 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.
> > > > 
> > > 
> > > The standard library makes the same mistake :P
> > 
> > It's included in the standard library? What standard library?
> 
> Mercury's standard library; it's what the predicate io.make_err_msg
> ultimately calls.

There is no make_err_msg in the io library. At least, it isn't in the
library reference manual.

> > > Also, you should consider using MR_strerror() from the runtime
> > > directory
> > > instead of strerror_r() directly.
> > 
> > What is the "runtime directory"?
> 
> The runtime directory in the Mercury source tree.

You mean, copy the code of MR_strerror and insert it in the posix
library?

Cheers
Volker



More information about the users mailing list