
0
Conventions for inherited calls
Yesterday we came accross a "nice" bug in our software which was hidden by inherited calls in constructors/destructors not being symmetrical.
constructor x.create; begin inherited; CreateLocalObjects; end; destructor x.destroy; begin inherited; <-- possible ouch CleanupLocalObjects; end;
Most of the time nothing bad happens here if it's just basic create and destroy of local objects, but if "CleanupLocalObjects" touches anything belonging to the inherited object, unpredictable results may happen.
Would it be possible to add the following two conventions:
- the inherited call in a constructor should be the first statement after "begin"
- the inherited call in a destructor should be the last statement before "end"
Customer support service by UserEcho