lua-users home
lua-l archive

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


On 2014-01-21 14:37, Roberto Ierusalimschy wrote:
2. I/O operations DO NOT clear the EOF indicator, despite they return a
valid, read characters.

Isn't this just a bug in libc? IIUC, in ANSI C, once the eof indicator
is set, any read should return EOF...

> [... - C STD fragments]

Indeed, however: ,,For input from a stream to return other than EOF after once returning EOF (with no intervening file-positioning operations or calls to clearerr) is non-conforming behavior, however widespread.'' (http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_141.html)

Is there any reasons for not putting ,,clearerr()'' in a front/back of ,,luaL_loadfilex()'' as in ,,liolib.c:g_read()''? Certainly, when there is no ,,fopen()/fclose()'' used (i.e., when ,,stdin'' is used).

--
-- best regards

Cezary H. Noweta