Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sequential_or: Fixed random order execution of underlying parsers
After two hours of fighting with the optimizer, I happily drew attention to this little nifty bitwise operator in `any_if_ns` function. Explanation of the bug: bitwise inclusive OR operator is not a sequence point (per chapter §5.13 of C++14 standard), that's why at compiling the expression `a() | b() | ... | z()` optimizer is allowed to rearrange the execution order of the functions `a`, `b` ... `z`. There is high chance that a lot of people were misguided by the bug and chose not to use `sequential_or`. I vaguely remember how about three years ago I thought that I am dumb and/or the documentation is wrong when I tried to use the `sequential_or` but ended with some workaround. There are three possible fixes: - Add and use strict order version of `any_ns` and `any_if_ns` functions - This one. Make the original `any_ns` and `any_if_ns` strict ordered (could potentially make permutations operator slower) - Break the `any_ns` and `any_if_ns` API and somehow generalize the code
- Loading branch information