警告:未使用计算的值
warning: value computed is not used
为什么在"BIO_flush(b64);"行收到警告消息"warning:value computed is not used",我该如何消除它?
unsigned char *my_base64(unsigned char *input, int length)
{
BIO *bmem, *b64;
BUF_MEM *bptr;
b64 = BIO_new(BIO_f_base64());
bmem = BIO_new(BIO_s_mem());
b64 = BIO_push(b64, bmem);
BIO_write(b64, input, length);
BIO_flush(b64);
BIO_get_mem_ptr(b64, &bptr);
unsigned char *buff = (unsigned char *)malloc(bptr->length+1);
memcpy(buff, bptr->data, bptr->length-1);
buff[bptr->length-1] = 0;
BIO_free_all(b64);
return buff;
}
处理这些错误的常用方法是"显式抛出返回值":
(void) BIO_flush(b64);
或者,您可以通过添加-Wno-unused-value
标志来选择同时关闭此警告。
上面显然假设您对返回值不感兴趣。如果您不确定,请查看文档中返回的确切内容,并决定是否要存储/使用它。
相关文章:
- 在计算中使用二的幂有多有利可图
- 普通环路未使用gcc 4.8.5自动矢量化
- 在更改for循环的第三部分后,未使用for循环结果
- 使用typeid警告未使用的变量
- C++删除未使用的类属性会导致 std::logic_error
- 警告 C4552:">>":未使用表达式的结果
- (SFML)按下键时,播放器构造函数未使用正确的动画进行更新
- 为什么我会收到警告,指出函数已使用但未定义,以及已定义但未使用?
- 如果我想链接静态库并删除未使用的符号.txt我应该如何处理 Cmakelist
- 可视化C++载体:未使用的容量
- GCC 中 __attribute__((未使用)) 和 __attribute((未使用)) 之间的区别
- C++计算未以正确的格式打印
- 循环访问还包含未使用元素的字符串数组
- Q维德格特关闭事件(..)未使用 QProcess::terminate() 调用
- Visual Studio "fatal error LNK1104: cannot open file"未使用或包含的库
- G++ 编译器是否在未使用返回值的情况下将 constexpr 函数视为常规函数?
- 链接器输入文件未使用,因为链接未完成,我无法获得.o
- 未使用的C++未优化的静态成员函数/变量
- 仅当一个参数中未使用 std::function 时,模板函数替换才有效
- 警告:未使用计算的值