Post Locked by Dennis♦ occurred Oct 28 '17 at 1:50 Notice added Historical significance by Dennis♦ occurred Oct 28 '17 at 1:50 Question Unprotected by Blue occurred Oct 24 '17 at 2:58 Post Closed as "off-topic" by cat, DJMcMayhem♦, mbomb007, Erik the Outgolfer, user902383 occurred Nov 30 '16 at 15:09 9 This was never a popularity contest, and can't retroactively be defined as one. I accepted the first correct answer, regardless of vote count. It may have been a bad idea, but it's way too late to change it. edited Nov 30 '16 at 7:32 ugoren 15.3k44 gold badges4343 silver badges7070 bronze badges The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. As a popularity-contest, the winner is the answer with the most upvotes minus downvotes. My own criteria for choosing answers are as follows, and I recommend voting up answers that meet them accordingly: Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. As a popularity-contest, the winner is the answer with the most upvotes minus downvotes. My own criteria for choosing answers are as follows, and I recommend voting up answers that meet them accordingly: Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. 8 clarify the victory condition in response to a close vote edited Nov 29 '16 at 19:11 user62131 The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. WinningAs a popularity-contest, the winner is the answer with the most upvotes minus downvotes. My own criteria for choosing answers are as follows, and I recommend voting up answers that meet them accordingly: Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. Winning criteria: Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. The challenge: Define x in such a way that the expression (x == x+2) would evaluate to true. I tagged the question with C, but answers in other languages are welcome, as long as they're creative or highlight an interesting aspect of the language. I intend to accept a C solution, but other languages can get my vote. As a popularity-contest, the winner is the answer with the most upvotes minus downvotes. My own criteria for choosing answers are as follows, and I recommend voting up answers that meet them accordingly: Correct - works on standard-compliant implementations. Exception - assuming an implementation of the basic types, if it's a common implementation (e.g. assuming int is 32bit 2's complement) is OK. Simple - should be small, use basic language features. Interesting - it's subjective, I admit. I have some examples for what I consider interesting, but I don't want to give hints. Update: Avoiding the preprocessor is interesting. Quick - The first good answer will be accepted. After getting 60 answers (I never expected such prticipation), It may be good to summarize them. The 60 answers divide into 7 groups, 3 of which can be implemented in C, the rest in other languages: The C preprocessor. #define x 2|0 was suggested, but there are many other possibilities. Floating point. Large numbers, infinity or NaN all work. Pointer arithmetic. A pointer to a huge struct causes adding 2 to wrap around. The rest don't work with C: Operator overloading - A + that doesn't add or a == that always returns true. Making x a function call (some languages allow it without the x() syntax). Then it can return something else each time. A one-bit data type. Then x == x+2 (mod 2). Changing 2 - some language let you assign 0 to it. 7 edited tags | link edited Sep 30 '14 at 13:09 user16402 6 deleted 3 characters in body; edited tags edited Jun 7 '14 at 18:33 Doorknob♦ 55.8k1717 gold badges119119 silver badges358358 bronze badges 5 edited tags | link edited Jun 4 '14 at 13:04 user16402 Question Protected by Community♦ occurred Mar 10 '14 at 16:29 4 added 17 characters in body edited Oct 27 '12 at 10:04 ugoren 15.3k44 gold badges4343 silver badges7070 bronze badges Post Made Community Wiki by PleaseStand occurred Oct 21 '12 at 22:35 3 added 819 characters in body edited Sep 22 '12 at 16:42 ugoren 15.3k44 gold badges4343 silver badges7070 bronze badges Tweeted twitter.com/#!/StackCodeGolf/status/243816206849687552 occurred Sep 6 '12 at 21:01 2 added 54 characters in body edited Sep 6 '12 at 10:14 ugoren 15.3k44 gold badges4343 silver badges7070 bronze badges 1 asked Sep 6 '12 at 9:05 ugoren 15.3k44 gold badges4343 silver badges7070 bronze badges