On 08/04/16 12:10, Martin Liška wrote:
On 08/04/2016 05:13 PM, Nathan Sidwell wrote:
On 08/04/16 10:42, Martin Liška wrote:
I decided to use a new enum, hope it's better?
that's fine. But you know, if you set the enum values appropriately you could
use the | trick rather than the compare you've done (c++ enum type safety would
require an overloaded | operator though). I don't mind either way,
Yeah, I decided to use enum + operator|.
You have a bug. The enum values are {0,1,2}, So the result of meeting both
regular and reversed loops will be the value '3'. so the check for ==
NEGATIVE_LOOP could erroneously fail. Fixable by making NEGATIVE_LOOP's value 2
+ LOOP (or many other variants on that theme).
+ if (w == start)
+ {
+ /* Cycle has been found. */
+ result |= handle_cycle (path, count);
+ }
{...} not necessary here (even with the comment).