Re: learning dragonfly or C...

看板DFBSD_kernel作者時間21年前 (2004/11/12 04:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串7/23 (看更多)
Well, George... in fact I've already made precisely the optimization you thought would clean up the code a few days ago. It's part of my VFS patchset. Now is that a coincidence or not? Generally speaking, however, programmers do not make that sort of unoptimized algorithm mistake very often, and you will find that most of the other situations in the codebase where a double-indirect pointer is used have to be coded the way they are coded. This brings up an interesting ancillary issue in that you might also see a very experienced C programmer use a slightly different sort of construction, like this: struct vnode *vp; struct vnode *nvp; if ((error = ckpt_fhtovp(&vnh->vnh_fh, &nvp)) != 0) return error; vp = nvp; /* nvp ignored, vp used from here on */ Care to take a guess at why advanced C programmers use this construction instead of simply passing &vp ? -Matt Matthew Dillon <dillon@backplane.com>
文章代碼(AID): #11ayn400 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #11ayn400 (DFBSD_kernel)