Use TDesC for interfaces which take narrow or wide (Unicode) text, depending on the build variant, but does not change the data.
An interface which needs access to either narrow text or wide (Unicode) text, depending on the build variant, but which does not need to change that data in any way, can use a TDesC as the argument type. All build independent concrete descriptors are derived from TDesC which means that the interface can accept any build independent descriptor.
The following code fragment shows the most common function prototype pattern.
The use of TDesC ensures that the data cannot be modified through the descriptor; const is an extra guarantee that the data cannot be changed.
If the interface is to handle explicit 8 bit or explicit 16 bit data, regardless of the build variant, then use TDesC8 or TDesC16 instead.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.