lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Instead of #defines, we try to keep a tight control over the use of
> stdlib. The core of Lua uses only malloc (and only through lmem.c), a
> single function from stdio (sprintf, to convert doubles to strings), and
> "light" functions (that is, functions that are very easy to implement
> directly in C, such as memcpy and isalpha).

OK, no complaints about the core, actually the only two things I had to
add were

typedef int ptrdiff_t;		// missing from stddef.h
#define strcoll	strcmp		// missing from string.h

> In the libraries we have a more relaxed standard. Even then, besides the
> stdio.h functions, I believe most of the functions we use are easily
> implemented, one way or another. And remember that you can include
> a LUA_USER_H header file when compiling Lua, and you can use it to

Thanks for that one, hadn't noticed it.

>   In file lua_user.h or directly in the makefile:
> 
>   #define strerror(x)   "unknown error"
>
> Similarly, if your system does not support `fseek', you can add
> 
>   #define fseek(a,b,c)  luaL_error(L, "`seek' not supported")
> 
> Or more drastically (and more Lua-independent):
> 
>   #define fseek(a,b,c)  assert(((void)"seek not supported", 0))

Good ideas, thanks. 

Ivan