Messages in this thread | | | Date | Wed, 12 Jun 2002 21:45:22 +0200 (CEST) | From | Ingo Molnar <> | Subject | Re: [PATCH] 2.5.21 - list.h cleanup |
| |
On Tue, 11 Jun 2002, Rusty Russell wrote:
> The number of structures and functions which need only "struct xxx *" > is very high: removing typedefs is something about with ~zero pain > (unlike dropping the sometimes-dubious loveaffair with inlines). > > Rusty. > PS. I blame Ingo: list_t indeed!
the reason why i added list_t to the scheduler code was mainly for aesthetic reasons. I'm still using 80x25 text consoles mainly, which are more sensitive to code length. Also, 'struct list_head' did not reflect the kind of lightweight list type we have, 'list_t' does that better. Eg.:
unsigned int void some_function(list_t *head, list_t *next, list_t *prev) { }
instead of:
unsigned int some_function(struct list_head *head, struct list_head *next, struct list_head *prev) { }
but if typedefs create other problems then these arguments are secondary i guess. I'm completely against redefining base types for no particular reason, like counter_t.
But i think it would be useful to introduce some sort of '_t convention', where _t always means a complex (or potentially complex - opaque) type. It makes code so much more compact and readable, and it does not hide anything - _t *always* means a complex type in the way i use it.
To see this in action check out 2.5's drivers/md/raid5.c for example, replace all the _t types with their full-blown struct equivalents and compare code readability. And this is not broken code in any way, it's just code that uses lots of complex types.
Ingo
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |