Re: [PATCH] address_space_operations unification

From: Ed Carp (erc@pobox.com)
Date: Sun May 07 2000 - 09:31:40 EST


Linus Torvalds (torvalds@transmeta.com) writes:

> Using a "void *" as a way of saying "this is an opaque pointer, don't
> care, we'll cast it to what we think is the right type later" is an
> absolutely _evil_ and disgusting construct.
>
> If you'd bother to take a look, you'd notice that I've pretty much never
> allowed void pointers in the core kernel code. As far as I'm concerned, it
> is a sign of bad design and horrible maintenance.

THANK YOU. I have been saying this since the mid 80's, when I first became aware of void * in C.

> "void *" is acceptable for two things:
> - memory allocators return "void *". It truly is a generic pointer, and
> the allocator had better cast it immediately (and that should be an
> implicit cast due to a pointer assignment). The memory free routine
> obviously also takes a void * argument.
> - functions that truly don't care (and never will, ie it never gets
> casted to anything else downstream) get a "void *". This is stuff like
> memcpy(), memset() etc.

Then why is it so liberally sprinkled throughout the header files? I agree with you, it's just that RMS and company seem to think it's some sort of generic thing that can be used anwhere.

-
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 : Sun May 07 2000 - 21:00:20 EST