c++ leetcode报错笔记


  warning: if statement has empty body [-Wempty-body]

  可能句末多打了分号。

 

  warning: using the result of an assignment as a condition without parentheses [-Wparentheses]

  leetcode编译器不允许在括号内赋值。

 

  runtime error: index -2 out of bounds for type 'vector<p> [10010]' (solution.cpp)

  下标越界。(不一定是大于上限,可能是小于0了。)

 

  add explicit braces to avoid dangling else [-Wdangling-else]

  添加括号以避免不必要的错误。(括号前后不对齐,比如有3个“(”却只有2个“)”。)

 

  error: member reference type 'TreeNode *' is a pointer; did you mean to use '->'?

  类型出错。

  

  error: reference to 'end' is ambiguous

  可能和库中变量名重复了。

 

  error: indirection requires pointer operand ('int' invalid)

  我引发这个错误的原因是递归忘了返回,指针会指到空值。

 

  ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000078 at pc 0x00000034c175 bp 0x7ffff3521b00 sp 0x7ffff3521af8

  我引发这个错误的原因是数组越界。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM