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.
void ClassX::foo(const TDesC& anArg);
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.