diff --git a/docs/develop/ikteam/BinCompat.html b/docs/develop/ikteam/BinCompat.html index 6048e871c8..51524fbb3e 100644 --- a/docs/develop/ikteam/BinCompat.html +++ b/docs/develop/ikteam/BinCompat.html @@ -76,6 +76,7 @@ should be binary compatible in no time! class BFoo { public: BFoo(); + ~BFoo(); void SomeFunc(); private: int32 fBar; @@ -117,7 +118,7 @@ should be binary compatible in no time! int32s worth of data: fNewData1 through fNewData4. The original implementation of BFoo has two extra int32s which we can use, but that leaves us two int32s - short. What to do? The easiest thing to do is create a data structure to hold + short. What to do? The easiest thing is to create a data structure to hold your new data and convert one of the fUnused items into a pointer to that structure: @@ -155,8 +156,12 @@ should be binary compatible in no time! } - Voila! More data without making the class bigger. Notice the added - destructor; make sure you're cleaning up your new (dynamically allocated) data. + Voila! More data without making the class bigger. Make sure you're cleaning up + your new (dynamically allocated) data in the destructor. NOTE: this trick + will only work if the class originally had a destructor! Adding a destructor + after the fact won't work for existing apps (since they won't call it), leading + to memory leaks. Fortunately, there are very few instances in the BeAPI where a + class doesn't have a destructor already declared.