lua-users home
lua-l archive

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


Glenn Maynard wrote:
On Mon, Nov 28, 2005 at 07:17:08AM -0200, Luiz Henrique de Figueiredo wrote:

No API function tests anything. In C, you're on your own, as in any
other C library.


Well, a great many libraries do consistency checks (and a great many
others don't).  eg. open(NULL, O_RDONLY) will return errno EFAULT, not
segfault (at least in Linux).  It's just a design choice.

In this case I agree with the Lua choice of speed vs. consistency. All those API checks can take a lot of time. Of course a few more asserts might help find the source of usage errors like this...

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'