<div class="gmail_quote">On Mon, Jun 6, 2011 at 20:00, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":3c4">So is the only benefit that one does not need the extra characters (void**) in front of the argument?<br></div></blockquote><div><br></div><div>Yes.</div><div><br></div><div><div>Rationale.</div><div><br></div>
<div>The use of a formal parameter attribute_val or type void* (rather than void**) avoids the messy type casting that would be needed if the attribute value is declared with a type other than void*. ( End of rationale.) </div>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":3c4">
<br>
Doesn't seem like much of a benefit? At this point I think doing it either way is fine but if we are inconsistent we should fix some of them to be consistent. I am leaning to vote for the (void**) approach; it is clearer when one looks at code.</div>
</blockquote></div><div><br></div>I think the cast is ugly if it appears in places that should not be "scary". For example, I think DMDAVecGetArray(da,X,&x) is significantly nicer than DMDAVecGetArray(da,X,(void**)&x).<div>
<br></div><div>Needing an explicit cast makes the reader think about the safety of the cast. This is a good thing for calls that should look a bit scary.</div>