スレッド セーフティと一般的なセキュリティの観点から、次のコードに何か問題がありますか?
std::string & toHexString( const uint8_t *buf, uint32_t size, std::string &out )
{
// modify 'out'
return out;
}
#ifndef TOHEXSTR
#define TOHEXSTR( x, y, ) ( toHexString( x, y, std::string() ) ).c_str()
#endif
これを使用する方法は、デバッグ ステートメントを出力することです。
printf( "Byte buffer contents: [%s].", TOHEXSTR( buf, buf_size ) );
この実装に問題がある場合、何を変更する必要がありますか?
ありがとう。