Monday, May 09, 2005
Tip 1: Never instantiate a TDes or a TDesC
TPtrC original(KExample); // a valid TDesC-derived descriptor
// Shallow copy the type and length into base class object
TDesC copy(original); // Uses the implicit copy constructor
Your code probably won’t crash if it has been written safely, but you will rarely have a valid reason for doing this. The code will fail to work anyway, because TDes and TDesC contain no string data, so in effect are abstract classes.