DragonFly BSD
DragonFly kernel List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: learning dragonfly or C...

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Nov 2004 12:18:51 -0800 (PST)

    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 ?

					Matthew Dillon 

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