Re: vmstat WARNS6 cleanup

看板DFBSD_submit作者時間21年前 (2005/01/09 04:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/10 (看更多)
> If you want to split out the rest of the cleanup, e.g. the statification, > I can commit that. Will do. > Commited with some additional cleanup. I prefer retval as variable name > over rc, it's also simpler to set the default value to -1. Also if you > add code, please use the normal file indentation rules. Apologies. Time to add the appropriate style hook in ~/.emacs... > Actually, alloca has the disadvantage of putting possible a lot of data > on the stack. For classic single threaded apps, that's not a problem, > for multithreaded code it might be. Yes, I am aware of this. Hence any use of alloca is going to be an optimiation only, conditional on the buffer size being below some small value -> malloc would be required anyway so it doesn't solve the exit path issue. Anyways. I'm actually not such a big fan of this type of thing (I would tend to just go with malloc unless it is something extremely performance critical). Just wanted to justify the use of malloc in case dynamic memory allocations are greatly discouraged as a matter of policy. > It's also important to keep in mind > that alloca is not really portable. I'm aware of this too, but spotted usage of alloca elsewhere, so I figured it wasn't banned. But point taken. :) -- / Peter Schuller, InfiDyne Technologies HB PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@infidyne.com>' Key retrieval: Send an E-Mail to getpgpkey@scode.org E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org
文章代碼(AID): #11u3m400 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #11u3m400 (DFBSD_submit)