Re: memset as memzero

Linus Torvalds
2007-09-23T17:11:29Z

On Sun, 23 Sep 2007, Arnaldo Carvalho de Melo wrote:
>
> bzero! That is it, its nothing new, just a sane name to something [..]

No, please no!

The BSD memory functions are nasty. If you do bzero, you logically should
do the others too, and they are way inferior to the standard ones. Let's
not go there.

Besides, if we want to avoid mistakes, I would suggest going to a much
higher level. Ie more along the lines of also fixing the size and
alignment, and using something like

#define memclear(p) memset(p, 0, sizeof(*(p)))

because if you actually do something like

git grep 'memset.*,[ ]*0[ ]*,'

(those [..] things contatain a space and a tab), you'll see that a *lot*
of them share that pattern.

Not that I think it's really worth it.

Linus