45得票9回答
gcc-8 -Wstringop-truncation的最佳实践是什么?

GCC 8新增了一个-Wstringop-truncation警告。来自https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82944: -Wstringop-truncation警告是在GCC 8.0通过r254630为81117号错误添加的, ...

36得票5回答
当2维数组别名化时,strlen的意外优化

这是我的代码:#include <string.h> #include <stdio.h> typedef char BUF[8]; typedef struct { BUF b[23]; } S; S s; int main() { int n...

18得票1回答
保证复制省略的行为是否依赖于用户定义的复制构造函数?

在GCC 8.0.1下,以下代码在有或没有自定义复制构造函数时表现不同: #include <cassert> struct S { int i; int *p; S() : i(0), p(&i) {} // S(const S &am...

9得票1回答
在Windows 10上使用nuwen MinGW实现C++17文件系统

我想尝试使用C++17中的新文件系统库,因此尝试复制cppreference.com上std::filesystem::current_path示例并使用最新版本(16.0)的nuwen.net MinGW发行版在我的Windows 10 x64机器上编译。这包括gcc v8.1,根据cppr...

7得票3回答
谷歌的Sparsehash在非平凡可复制类型上使用realloc()函数

考虑这个简单的程序: #include <string> #include <sparsehash/dense_hash_map> int main() { google::dense_hash_map<std::string, int> map...