lua-users home
lua-l archive

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


It would be nice if someday the C API was made const correct.  I'm referring
to the lua_State argument of all the API functions.  If a function does not
affect the state, the state pointer argument should be qualified as const.

Const correctness is an important part of any interface because it lets the
user know which pass-by-pointer arguments may be modified, and lets the
compiler check the pointer use.

Of course this wouldn't be a trivial correction to Lua because the const
correctness would have to trickle down into the whole implementation.  As a
benefit the implementation would become more readable because all function
interfaces would be clarified.

For now, if someone on the Lua team would at least make a list of API
functions that don't modify state I will cast to const manually in a wrapper
API.

Regards,
-John