PVS-StudioWarnings

PVS-Studio warning V561 for FlightGear

Nov 20th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. void DCLGPS::update(double dt) {
  2.   ....
  3.   string s;
  4.   if(fgGetBool("/instrumentation/nav[0]/slaved-to-gps")) {
  5.     // TODO - avoid the hardwiring on nav[0]
  6.     s = "Adj Nav Crs to ";
  7.   } else {
  8.     string s = "GPS Course is ";
  9.   }
  10.   ....
  11. }
  12.  
  13. This suspicious code was found in FlightGear project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V561 It's probably better to assign value to 's' variable than to declare it anew. Previous declaration: dclgps.cxx, line 480. dclgps.cxx 485
  16.  
  17. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment