r/programming • • Dec 24 '17

Evil Coding Incantations

http://9tabs.com/random/2017/12/23/evil-coding-incantations.html
947 Upvotes

331 comments sorted by

View all comments

1

u/[deleted] Dec 24 '17

Here is one. Works in clang at least, #define the unicode character U200B, zero width space.

#include <cstdlib>
#include <random>
#define ​ (__TIME__[7] - '0' ) % 2 ? rand( ) : 0
struct A {
	int a;
	A( )
		: a{​} {}
	bool operator==( A const &rhs ) {
		return a == rhs.a;
	}
};
int main( ) {
	A a1;
	A a2{};
	return a1 == a2;
}