On 13 May 2011 15:50, Barry Smith <bsmith at mcs.anl.gov> wrote: > > On May 13, 2011, at 7:01 AM, Lisandro Dalcin wrote: > >> On 13 May 2011 01:51, Barry Smith <bsmith at mcs.anl.gov> wrote: >>> >>> On May 12, 2011, at 4:48 PM, Lisandro Dalcin wrote: >>> >> >> Barry, now I want to understand: Why did you coded XXXDestroy() to >> call XXXReset()? Was that just to avoid code duplication? Or is it >> there some other rationale? > > ? XXXReset() is a "partial" destroy. >
I do not agree with your definition, though I understand your point. But if you think that Reset() is a partial destroy, and agree that the MatPreallocated() hack I removed was a good fix, then we can go on and let things stay as today. > > ? ? I would state that any language that makes it impossible or cumbersome to > have a destructor call another method on the destructed object (you claim > python and C++?) is very fragile and should be rethought. > Again, this is because in PETSc you do not care about error recovery, you just MPI_Abort() in normal cases, or offer no guarantees about continuing execution after errors. I'm not blaming PETSc for this, it is just like MPI-2!. BTW, Writing a REALLY good destructor in C++ is a pain. What's happens if an exception is thrown in the middle of object destruction and you still have things to delete[]? -- Lisandro Dalcin --------------- CIMEC (INTEC/CONICET-UNL) Predio CONICET-Santa Fe Colectora RN 168 Km 472, Paraje El Pozo 3000 Santa Fe, Argentina Tel: +54-342-4511594 (ext 1011) Tel/Fax: +54-342-4511169
