Skip to content

Instantly share code, notes, and snippets.

@rgkirch
Created June 24, 2017 23:48
Show Gist options
  • Save rgkirch/049d20c9d8c4564be72f5fac22df348e to your computer and use it in GitHub Desktop.
Save rgkirch/049d20c9d8c4564be72f5fac22df348e to your computer and use it in GitHub Desktop.
Just found the bug.
void correct(function<void(char)> f) {
vector<char> cs {'\x1B','\x25','\x01','\x1B','\x26','\x01'};
for ( auto c : cs ) f(c);
}
void wrong(Object o) {
o.print("\x1B\x25\x01\x1B\x26\x01");
}
// wrong is wrong because it prints
// 27 37 1 27 38 1 0
// while correct is correct because it prints
// 27 37 1 27 38 1
// ...sigh...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment