Re: memset as memzero

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Arnaldo Carvalho de Melo <acme@...>
Cc: Dave Jones <davej@...>, Arjan van de Ven <arjan@...>, Cyrill Gorcunov <gorcunov@...>, LKML <linux-kernel@...>, Andrew Morton <akpm@...>, Ingo Molnar <mingo@...>
Date: Sunday, September 23, 2007 - 1:05 pm

On Sun, 23 Sep 2007, Arnaldo Carvalho de Melo wrote:

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
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
memset as memzero, Cyrill Gorcunov, (Sat Sep 22, 4:33 am)
Re: memset as memzero, Arjan van de Ven, (Sat Sep 22, 3:46 pm)
Re: memset as memzero, Cyrill Gorcunov, (Sat Sep 22, 3:32 pm)
Re: memset as memzero, Bernd Eckenfels, (Sat Sep 22, 3:25 pm)
Re: memset as memzero, Linus Torvalds, (Sat Sep 22, 2:53 pm)
Re: memset as memzero, Dave Jones, (Sun Sep 23, 11:32 am)
Re: memset as memzero, Robert P. J. Day, (Sun Sep 23, 12:33 pm)
Re: memset as memzero, Arnaldo Carvalho de Melo, (Sun Sep 23, 12:46 pm)
Re: memset as memzero, Arnaldo Carvalho de Melo, (Sun Sep 23, 12:07 pm)
Re: memset as memzero, Linus Torvalds, (Sun Sep 23, 1:05 pm)
Re: memset as memzero, Willy Tarreau, (Sun Sep 23, 2:46 pm)
Re: memset as memzero, Robert P. J. Day, (Sat Sep 22, 4:48 am)
Re: memset as memzero, Cyrill Gorcunov, (Sat Sep 22, 5:35 am)
Re: memset as memzero, Robert P. J. Day, (Sat Sep 22, 5:55 am)
Re: memset as memzero, Cyrill Gorcunov, (Sat Sep 22, 6:15 am)