Menu

#3 Drilldoc.h && short-circuit not working because || has same priority

Main Group
closed
nobody
None
5
2014-04-01
2014-02-23
No

The following code:

            for(;
                i < strNCDrill.length() &&
                (strNCDrill[i] >= '0' && strNCDrill[i] <= '9') ||
                strNCDrill[i] == '.';
                i++
                )

does strNCDrill[i] == '.' one byte after string end.

It should be:
~~~~~~
for(;
(i < strNCDrill.length()) &&
((strNCDrill[i] >= '0' && strNCDrill[i] <= '9') ||
strNCDrill[i] == '.');
i++
)
~~~~~

Discussion

  • Sergey S. Fukanchik

    proposed patch

     
  • Stepan Dyatkovsky

    Fixed in r9

     
  • Stepan Dyatkovsky

    • status: open --> closed
     

Log in to post a comment.