GCC和MSVC警告之间是否有任何良好的映射?例如 - MSVC上的wredlaction -move

发布于 2025-01-26 20:53:50 字数 278 浏览 1 评论 0原文

这个问题有点两折,一个比另一个更一般。具体的问题是; MSVC是否有等效的警告-Wredeartion-Move?更一般而言,即使是某人的博客,在网上是否可以在任何地方都有合理的GCC和MSVC警告映射?

我知道警告不需要任何类似的累积平台,甚至根本存在 - 这就是为什么我有兴趣找出是否存在任何合理的相关性?

对于一小部分背景,我希望在跨平台项目上启用特定的-werror s,并且希望每个平台都会照顾大致相同的警告,而不是依靠用户来手动检查两个平台。

This question is somewhat two fold, one being more general than the other. The specific question is; does MSVC have equivalent warnings to -Wredundant-move? More generally, is there anywhere online, even if it's someone's blog, that has a reasonable mapping between GCC and MSVC warnings?

I'm aware that warnings don't have any requirement to be similar accross platforms, or even exist at all - that's why I'm interested to find out if there is any reasonable correlation?

For a small bit of background, I'm looking to enable specific -Werrors on a cross-platform project, and would prefer if each platform looked after roughly the same warnings instead of relying on the user to check on both platforms manually.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残龙傲雪 2025-02-02 20:53:50

具体问题是; MSVC是否有等效的警告-WredEarment-Move

从我发现的情况下,不,MSVC没有。

如果GCC和MSVC警告之间有很好的映射,这隐含地回答了更普遍的问题。

但是 - 对于您问的特定警告,未来看起来很有希望:
在审查中 - 悲伤的移动编译器警告

“ llvm支持一个悲观的编译器警告。在C ++ 17和更新中,在临时调用std :: move()时,这会导致临时的复制elision。似乎是一个高价值的警告,在Clang ++和GCC中支持,,但不是MSVC 。”

The specific question is; does MSVC have equivalent warnings to -Wredundant-move?

From what I've found, no, MSVC doesn't.

This implicitly answers the more general question if there's a good mapping between gcc and MSVC warnings.

But - the future looks promising for the particular kind of warning you asked about:
Under Review - Pessimizing Move Compiler Warning:

"LLVM supports a pessimizing-move compiler warning. In C++17 and newer, this fires when invoking std::move() on a temporary, this results in copy elision not occurring on the temporary. This seems a high value warning that is supported in Clang++ and GCC, but not MSVC."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文