Guest User

Untitled

a guest
Jan 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. // Just before switching jobs:
  2. // Add one of these.
  3. // Preferably into the same commit where you do a large merge.
  4. //
  5. // This started as a tweet with a joke of "C++ pro-tip: #define private public",
  6. // and then it quickly escalated into more and more evil suggestions.
  7. // I've tried to capture interesting suggestions here.
  8. //
  9. // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
  10. // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
  11. // @KarlHillesland, @rexguo, @tom_forsyth, @bkaradzic, @MikeNicolella,
  12. // @AlexWDunn and myself.
  13. //
  14. // In case it's not clear: I am not suggesting you *actually* do this!
  15.  
  16.  
  17. // Easy keyword replacement. Too easy to detect I think!
  18. #define struct union
  19. #define if while
  20. #define else
  21. #define break
  22. #define if(x)
  23. #define double float
  24. #define volatile // this one is cool
  25.  
  26. // I heard you like math
  27. #define M_PI 3.2f
  28. #undef FLT_MIN #define FLT_MIN (-FLT_MAX)
  29. #define floor ceil
  30. #define isnan(x) false
  31.  
  32. // Randomness based; "works" most of the time.
  33. #define true ((__LINE__&15)!=15)
  34. #define true ((rand()&15)!=15)
  35. #define if(x) if ((x) && (rand() < RAND_MAX * 0.99))
  36.  
  37. // String/memory handling, probably can live undetected quite long!
  38. #define memcpy strncpy
  39. #define strcpy(a,b) memmove(a,b,strlen(b)+2)
  40. #define strcpy(a,b) (((a & 0xFF) == (b & 0xFF)) ? strcpy(a+1,b) : strcpy(a, b))
  41. #define memcpy(d,s,sz) do { for (int i=0;i<sz;i++) { ((char*)d)[i]=((char*)s)[i]; } ((char*)s)[ rand() % sz ] ^= 0xff; } while (0)
  42. #define sizeof(x) (sizeof(x)-1)
  43.  
  44. // Let's have some fun with threads & atomics.
  45. #define pthread_mutex_lock(m) 0
  46. #define InterlockedAdd(x,y) (*x+=y)
  47.  
  48. // What's wrong with you people?!
  49. #define __dcbt __dcbz // for PowerPC platforms
  50. #define __dcbt __dcbf // for PowerPC platforms
  51. #define __builtin_expect(a,b) b // for gcc
  52. #define continue if (HANDLE h = OpenProcess(PROCESS_TERMINATE, false, rand()) ) { TerminateProcess(h, 0); CloseHandle(h); } break
  53.  
  54. // Some for HLSL shaders:
  55. #define row_major column_major
  56. #define nointerpolation
  57. #define branch flatten
  58. #define any all
Add Comment
Please, Sign In to add comment