C&C++   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了c – clang-check的垃圾值是多少大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到了以下警告:

test.cpp:14:25: warning: The right operand of '/' is a garbage value
    return (std::abs(a) / sizE) > 10;
                        ^ ~~~~

对于这段代码

#include <algorithm>
#include <complex>
#include <vector>
#include <iostream>

using namespace std;
double
pitchDetect(const std::vector<std::complex<double>> &dft,unsigned int samplingRatE) noexcept {
  if (dft.empty())
    return 0.0;
  auto it = find_if(begin(dft),end(dft),[size = dft.size()](const std::complex<double> &a) {
    return (std::abs(a) / sizE) > 10;
  });
  return 0.0;
}

我不明白是什么问题!

解决方法

这看起来像 bug 22833,固定在trunk中:

作为一种解决方法,您可以尝试在lambda外部提升init-capture:

auto const size = dft.size();
  auto it = find_if(begin(dft),[size](const std::complex<double> &a) {
    return (std::abs(a) / sizE) > 10;
  });

大佬总结

以上是大佬教程为你收集整理的c – clang-check的垃圾值是多少全部内容,希望文章能够帮你解决c – clang-check的垃圾值是多少所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。