当前位置:   article > 正文

leetcode 报错_summary: undefinedbehaviorsanitizer: undefined-beh

summary: undefinedbehaviorsanitizer: undefined-behavior
  1. Line 7: Char 9: runtime error: index 30 out of bounds for type 'int [30]' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:16:9
    数组越界,把int[30]改成int[31]

  2. C++ requires a type specifier for all declarations dp[0]=0;
    翻译:
    c++要求所有声明都有类型说明符
    没彻底理解,但是知道了解决方法
    出错原因: 代码片段没有写在函数中。
    解决方法: 将代码片段写进函数中。

  3. runtime error: addition of unsigned offset to 0x602000000010 overflowed to 0x60200000000c (stl_vector.h)
    翻译:
    无符号偏移量从0x602000000010溢出到0x60200000000c (stl_vector.h)
    解决:
    避免数组下标小于0

  4. reference binding to null pointer of type 'int' (stl_vector.h)
    翻译:引用绑定到类型为int的空指针
    原因:在声明vector容器的时候没有指定大小,但是在用的时候当作指定了大小的数组用了。
    解决:
    用push_back

  5. runtime err

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号