gpt4 book ai didi

clang++ - 为什么 clang++ 警告 "suggest braces around initialization of subobject [-Wmissing-braces]"?

转载 作者:行者123 更新时间:2023-12-03 07:50:54 32 4
gpt4 key购买 nike

我有这个代码:

#include <array>

int main(int, char **argv)
{
std::array<int, 3> a = {1,2,3};
}

这编译得很好 (-std=c++11) ,但如果你包含 -Wall 它会给出这个我不明白的警告:
clang_pp_error.cpp:5:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
std::array<int, 3> a = {1,2,3};
^~~~~
{ }

最佳答案

关于clang++ - 为什么 clang++ 警告 "suggest braces around initialization of subobject [-Wmissing-braces]"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31555584/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com