lua-users home
lua-l archive

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

Ranier Vilela <> 于2020年11月10日周二 下午9:54写道:
> Ok, I think that it was very clear.
> But C programmer shouldn't worry about filling memory with NULLs,

The point is as Andrew Gierth said , "modern compilers will
transform assignment loops into memset calls or inline implementations
of memset if circumstances suggest it will be both allowable and
efficient to do so" .

In my opinion, better C code should express the programmer's intention directly.
We need init the array with NULLs, memset is only a shallow
optimization that the compilers can do it well.