[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua crashing on unrecognized strings
- From: "Thomas Harning Jr." <harningt@...>
- Date: Fri, 28 Aug 2009 00:28:44 -0400
On Thu, Aug 27, 2009 at 3:06 PM, Roberto
Ierusalimschy<roberto@inf.puc-rio.br> wrote:
> ISO/IEC 9899:1999 (E) says this (Section 7.19.5.3):
>
> The argument 'mode' points to a string. If the string is one of the
> following, the file is open in the indicated mode. Otherwise, the
> behavior is undefined.
>
> r open text file for reading
> ...
>
>
> This is very sad, but "the behavior is undefined" actually means that.
> (Even crashing is acceptable.)
Looking at windows-docs, there appears to be an invalid-input handler
you can register to handle bad input... too bad this is almost
definitely not the place for standard Lua to step in, but a module
could readily do it. Basically you'd want to replace the handler with
something that didn't "blow up".
It appears the idea is that the MS runtimes want the developer to
check all inputs, even when things should be sane... and if input is
wrong, the dev has to pick up the pieces in nasty ways.
--
Thomas Harning Jr.