[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A Batteries API specification (was Re: LuaDEAL - Lua DEad Alive Libraries)
- From: Sean Conner <sean@...>
- Date: Tue, 21 Jan 2020 12:14:55 -0500
It was thus said that the Great Xavier Wang once stated:
> Sean Conner <sean@conman.org> 于2020年1月21日周二 下午1:38写道:
> >
> > My thoughts for returning an error number instead of a string is that the
> > number is easier for error handling and if I want to print out a string, I
> > can use a wrapper for strerror() at that point. But aside from error
> > reporting, all three APIs are similar enough to get a feel for what might
> > make the minimum library. Here's what I have so far (excluding the error
> > reporting):
>
> I have my own module for directory functions[1], and I found that if
> you want cross platform native directory operations, you can not
> always get errno. Windows has its own routines and error codes for
> that.
The intent was to provide a API (and/or library) for the minimal
"batteries included" for Lua, but I can see this might be an uphill battle
(nothing terribly surprising there).
As for Windows, I'm not specifically looking to return errno (it *is*
defined for C, and there are a few C functions that do set it) but some
error number for error handling. The string is handy if all you want to do
is just print a message but if you want to do something based upon the type
of error, some numeric value is the best way to handle that. In fact, I
don't think I even mentioned errno at all.
-spc