in reply to Re^2: is index faster than regexp for fixed text token?
in thread is index faster than regexp for fixed text token?
This "trick" is part of first level class in 'C'. It is shown to demonstrate power of XOR. It looks cool but it is inefficient and in general not a good idea even though it produces a correct result. XOR is "more expensive", meaning takes longer than other simple bitwise ops like OR or AND or NOT. Anyway this construct is just demonstrated to explain XOR, it is not practical is not used even in 'C'.
In Perl, this is bad code! - just wrong.
The Perl way: ($a,$b)=($b,$a);
the above is practical and could be used.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: is index faster than regexp for fixed text token?
by sflitman (Hermit) on Jul 11, 2009 at 01:41 UTC | |
by Marshall (Canon) on Jul 13, 2009 at 00:27 UTC |