This method has been designed so that standards compliant compilers won't optimize away writes to the destination if the destination is never used (as would be the case with a compiler implementing dead code detection).
Here's an example of a case that could potentially be optimized away when not using the "non-secure" form of this method:
* void somefunc(p6ISafeString *pStr)
* {
* P6BSTR bsPasswd = {&szBuffer,MAXPASS};
*
* getUserPasswd(&bsPasswd);
* useThePassword(&bsPasswd);
* pStr->bstrSetMem(bsPasswd,0);
* }
*
* In
this case the purpose of calling
bstrSetMem() in this situation is to
* clear the password buffer so that the password cannot be recovered from
* from memory later. However, the compiler may optimize away that call
* since the memory is never referenced again.
*
*