Menu

#135 assignment in if statement in library header file that contains code

3.4
closed
1
2015-06-03
2012-10-01
No

when using clang the flag diacritics header code spams following warnings for each compilation unit:

  :info:build ../../libhfst/src/implementations/optimized-lookup/../../HfstFlagDiacritics.h:170:39: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
  :info:build                 if(next_diacritic_pos = std::string::npos)
  :info:build                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  :info:build ../../libhfst/src/implementations/optimized-lookup/../../HfstFlagDiacritics.h:170:39: note: place parentheses around the assignment to silence this warning
  :info:build                 if(next_diacritic_pos = std::string::npos)
  :info:build                                       ^
  :info:build                    (                                     )
  :info:build ../../libhfst/src/implementations/optimized-lookup/../../HfstFlagDiacritics.h:170:39: note: use '==' to turn this assignment into an equality comparison
  :info:build                 if(next_diacritic_pos = std::string::npos)
  :info:build                                       ^
  :info:build                                       ==

Discussion

  • Sam Hardwick

    Sam Hardwick - 2015-06-03

    This was fixed a while ago.

     
  • Sam Hardwick

    Sam Hardwick - 2015-06-03
    • status: open --> closed