lua-users home
lua-l archive

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


> It was thus said that the Great Irfan Adilovic once stated:
> > In the 5.3.3 release, lua/lstrlib.cc:936:
> > 
> >     char *ppoint = memchr(buff, point, nb);
> > 
> > is not valid c++ code. This should be fixed with a c-style cast:
> 
>   But it *is* valid C code.  In C, it's recommended *not* to cast the result
> of malloc() as it can hide errors (mainly missing declarations---in C,
> without a prototype, the compiler will assume a function returns an int).

We always use -Wmissing-prototypes, so this does not seem to be an
issue. Note that Lua already casts all the result of malloc (see macros
in 'lmem.h')---otherwise there would be lots of errors like this one.

-- Roberto