<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 11, 2020, at 2:58 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Fri, Sep 11, 2020 at 3:57 PM Ed Bueler <<a href="mailto:elbueler@alaska.edu" class="">elbueler@alaska.edu</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">Dear PETSc --<div class=""><br class=""></div><div class="">I notice in the users manual that the C examples show</div><div class=""><br class=""></div><div class="">ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;</div><div class=""><br class=""></div><div class="">at the start of main() and </div><div class=""><br class=""></div><div class="">ierr = PetscFinalize();<br class="">return ierr;</div><div class=""><br class=""></div><div class="">at the end of main().  Is this the deliberate, recommended style?</div></div></blockquote><div class=""><br class=""></div><div class="">Yes.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">  My understanding of these choices is that if PetscInitialize() fails then CHKERRQ(ierr) may not do the right thing,</div></div></blockquote><div class=""><br class=""></div><div class="">Yes, failure early-on in Initialize() can predate setting up error handling.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class=""> while if PetscFinalize() fails then that should be the result of main() (without any fiddling by CHKERRQ etc.).  Is this the correct understanding?</div></div></blockquote><div class=""><br class=""></div><div class="">Yes.</div></div></div></div></blockquote><div><br class=""></div>  If there is a failure in PetscFinalize() then PETSc will be in some unknown state where the CHKERRQ macros will no longer work so PETSc error handling should not be called.</div><div><br class=""></div><div>  Barry</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class=""></div><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">Thanks,</div><div class=""><br class="">Ed</div><div class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">Ed Bueler<br class="">Dept of Mathematics and Statistics<br class="">University of Alaska Fairbanks<br class="">Fairbanks, AK 99775-6660<br class="">306C Chapman<br class=""></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></body></html>