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

Re: memset bugs.



On Fri, Nov 27, 2009 at 1:26 AM, Roopesh Majeti
<roopesh majeti gmail com> wrote:
> Hi All,
> Iam new to this fedora world.. a small question on the below discussion:
> It is mentioned that having, zero in the third argument is legitimate use
> cases. Can somebody direct me to such a use case, as i feel, giving memset a
> zero, is asking it, not to do anything [ might have side effects, not sure
> from my end, though ].

It's legitimate because the zero may ultimately be derived from macro values
and restructuring the code to avoid the memset depending on defined values
may be non-trivial or even impossible.

John Reiser provided a good example:
http://www.linux-archive.org/fedora-development/286221-memset-bugs.html

Where its not a programming bug the memset(,,0) is harmless: GCC optimizes it
out completely.

A literal zero prior to preprocessing is either a bug, or some kind of dead-
code causing place-holder.


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