Re: Improved <linux/lists.h>

From: Bill Wendling (wendling@ganymede.isdn.uiuc.edu)
Date: Wed Feb 23 2000 - 14:09:44 EST


Also sprach Borislav Deianov:
} On Wed, Feb 23, 2000 at 01:02:45PM -0500, Jeff Garzik wrote:
} >
} > Look at how the PCI code stores the list of pci_drivers...
}
} OK, that code doesn't *depend* on the list_head being the first member
} of the struct (i.e. it always calls list_entry, and takes &drv->node,
} etc. where necessary). So it doesn't save you keystrokes but it does
} save you a few cycles since you don't need to mess with offsets at
} runtime to get to the struct. Cool micro-optimization, agreed.
}
} > Bill Wendling wrote:
} > > Plus, as per the CodingStyle doc, it's a "feature" of C. One that escapes
} > > the mind of most programmers, especially newer ones. Saving keystrokes
} > > shouldn't be the goal. Speeding up code should be the goal.
}
} Can't find a reference to anything like this in CodingStyle...

Chapter 4: Functions

[snip...]

However, if you have a complex function, and you suspect that a
less-than-gifted first-year high-school student might not even understand
what the function is all about, you should adhere to the maximum limits
all the more closely. Use helper functions with descriptive names (you
can ask the compiler to in-line them if you think it's
performance-critical, and it will probably do a better job of it that you
would have done).

---------------

It's more in keeping with the spirit of this statement, really.

:)

-- 
|| Bill Wendling			wendling@ganymede.isdn.uiuc.edu

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:33 EST