[lkml]   [2001]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] struct char_device
On Tue, 22 May 2001, Guest section DW wrote:

> On Tue, May 22, 2001 at 11:08:16AM -0500, Oliver Xymoron wrote:
> > > >+ struct list_head hash;
> > > Why not name consistently with the struct block_device?
> > > struct list_head cd_hash;
> > Because foo_ is a throwback to the days when C compilers had a single
> > namespace for all structure elements, not a readability aid. If you need
> > foo_ to know what type of structure you're futzing with, you need to name
> > your variables better.
> One often has to go through all occurrences of a variable or
> field of a struct. That is much easier with cd_hash and cd_dev
> than with hash and dev.
> No, it is a good habit, these prefixes, even though it is no longer
> necessary because of the C compiler.

A better habit is encapsulating your data structures well enough that the
entire kernel doesn't feel the need to go digging through them. The fact
that you have to change many widely-scattered instances of something
points to bad modularity. Supporting that practice with verbose naming is
not doing yourself a favor in the long run.

If you must, use accessor functions instead. At best you'll be able to
make sweeping semantic changes in one spot. At worst, you'll be able to
grep for it.

"Love the dolphins," she advised him. "Write by W.A.S.T.E.."

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:53    [W:0.059 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site