Hello.

David Brownell wrote:

Again, why "better"?  Passing "void *" is generally considered worse
than passing values with types that the compiler can verify.  People
I think your references to the "general practice" do not fit well in this particualr case. Your use of container_of() basically nullifies the benefit of the compiler's type checking

No.  The container_of() is type checked.

I don't know how else to explain to you that all typechecking is in vain if the client passes a copy of the "token" 'struct ata24_iface' (which it may e.g. "cache" internally for quicker access). Be it typed or untyped pointer that the client passes back to the read()/write() methods, the code will only work correct if that's one and the same pointer (or at least it's alias) that's passed to the setup() callback.

because the driver's read()/write() methods will only work correctly if passed the same "token" as given to the client via the setup() callback -- same way as if you were passing 'void *' pointing to 'struct at24_data' to setup() along with 'struct at24_iface *'.

Right, and the compiler will prevent a lot of the stupid errors
people routinely make when juggling "void *" values instead of
ones with an actual type.

Like what? And please be more concentrated on this particular case instead of appealing to the general practice.

I can't believe  that in 2008 you're actually advocating use of
a "void *" pointer instead of a typed one.

I can't believe one can so "consistently" ignore his oppenent's argumatation. Type checking will *not* avail you in this case. If you fail to undestand this, it's not my problem.

WBR, Sergei



_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to