On Tue, Feb 15, 2011 at 4:47 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
  In MPI one calls MPI_Comm_free(&comm) to allow the MPI implementation to set the pointer explicitly to 0 after the object is destroyed.<br>
<br>
  In Petsc XXXDestroy() does not pass the pointer (because it seemed too unnatural to me in 1994) thus not allowing 0ing the pointer.<br>
<br>
   Was this a bad design decision? Should it be revisited?<br>
<br>
   Barry<br>
<br>
  Two use cases<br>
<br>
1) error detection when someone tries to reuse a freed object<br></blockquote><div><br></div><div>We catch this with other error detection. I do not think we would gain much here.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

2) when removing some objects from a data structure that will be used data one currently needs to do<br>
<br>
  XXXXDestroy(mystruct->something);CHKERRQ(ierr); mystruct->something = 0;<br>
<br>
instead of the cleaner XXXDestroy(&mystruct->something);CHKERRQ(ierr); </blockquote></div><br>True, but again I do not think the win is large.<div><br></div><div>   Matt<br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>
</div>