There are a few places in PETSc where arguments that are logically void** are implemented as void*. This removes the need for the user to provide an explicit cast, and is backward compatible. MPI adopted this convention between version 1.0 and 1.1. For example,<div>
<br></div><div><div>int MPI_Attr_get(MPI_Comm comm, int keyval,void **attribute_val, int *flag ) /* MPI-1.0 */</div><div><br></div><div>int MPI_Attr_get(MPI_Comm comm, int keyval,void *attribute_val, int *flag ) /* MPI-1.1 and later */</div>
</div><div><br></div><div><br></div><div>Inside the implementation, the actual assignment would look something like</div><div><br></div><div>*(void**)attribute_val = comm->attr_table[keyval];</div><div><br></div><div><br>
</div><div>Should we adopt this uniformly? The benefit is that the user doesn't need to *always* cast to (void**) every time they call the function.</div><div><br></div><div>The downside is that the function signature does not make it obvious that the user should pass the address of their pointer. On the other hand, C pass-by-value semantics guarantee that the function couldn't do anything like what it says if you didn't pass in the address of your pointer.</div>
<div><br></div><div><br></div><div>Note that this change cannot be made for (void(**)(void)) function arguments because function pointers are not castable to non-function pointers (as per the C standard, though it works on many platforms).</div>