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