Date: Mon, 3 Mar 2014 16:19:40 +0100 From: "J. Hannken-Illjes" <hann...@eis.cs.tu-bs.de>
On Mar 3, 2014, at 4:11 PM, Taylor R Campbell <campbell+netbsd-tech-k...@mumble.net> wrote: > That is exactly what I was going for, except with a typed pointer > instead of a void pointer. Please explain in more detail why you prefer a typed pointer over a void pointer for opaque data. What is the benefit? If I pass in the wrong thing, then with a typed pointer, the compiler will warn; with a void pointer, it won't. E.g., consider: while (vfs_vnode_iterator_next(vi, &vp)) { ... /* Skip to the next one. */ if (!vfs_vnode_iterator_next(vp, &nvp)) break; ... } If vfs_vnode_iterator_next takes a void *, then the compiler will be happy with this and there's a nontrivial chance that this won't have any obvious adverse effects for a while. If vfs_vnode_iterator_next takes a struct vnode_iterator *, then the compiler will promptly inform me that I failed to mind my p's and i's.