[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4.2 (lua_newstate)
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Wed, 11 Nov 2020 10:06:52 +0800
Ranier Vilela <ranier.vf@gmail.com> 于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.
--
http://blog.codingnow.com