[TUHS] Tech Sq elevator [ really type-checking ]
Jon Steinhart
jon at fourwinds.com
Mon Jan 13 10:01:02 AEST 2020
Larry McVoy writes:
> On Sun, Jan 12, 2020 at 03:40:40PM -0800, Jon Steinhart wrote:
> > Linux contains several sets of list_for_each_entry() macros that are essentially
> > obfuscated for loops that generate inefficient code.
>
> Very common idiom in any real system. BitKeeper has them as well, they are
> used everywhere. They are too useful to not use. The BitKeeper ones give
> you most of Perl's list capabilities.
I don't see it. In the cases that I've seen so far in linux the only uses are
inserting, deleting, and traversing lists. My opinion that anyone who can't
write
for (p = list; p != NULL; p = p->next)
shouldn't be programming, much less in the kernel. To me, type-checking and
code clarity are vastly more important. If I want to program in Perl, I do
so. When I program in C that's what I do.
I do want to be clear that I'm coming at this from a code maintenance angle.
Code that I write for my personal use looks way different than what I write
professionally. I'm willing to put in more work up front to make sure that
other people can easily understand my code because I don't want to be stuck
maintaining stuff. And I recognize that unless one is coding a web page with
an expected lifespan of 30 seconds the cost of maintenance dwarfs the cost of
development.
Jon
More information about the TUHS
mailing list