是否安全调用qWarning“%s”,qUtf8Printablekey;

问题描述

Qt manu在使用qUtf8Printable()的语句之后,char指针将无效。这是因为QString::toUtf8()返回的数组将超出范围。

那么qUtf8Printable(key)会在调用qWarning("%s",Utf8Printable(key));时超出范围吗?

解决方法

这很安全。用作参数的临时值将保留到函数调用结束。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...