Guest User

Untitled

a guest
Aug 19th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 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.  
  15. // Easy keyword replacement. Too easy to detect I think!
  16. #define struct union
  17. #define if while
  18. #define else
  19. #define break
  20. #define if(x)
  21. #define double float
  22. #define volatile // this one is cool
  23.  
  24. // I heard you like math
  25. #define M_PI 3.2f
  26. #undef FLT_MIN #define FLT_MIN (-FLT_MAX)
  27. #define floor ceil
  28. #define isnan(x) false
  29.  
  30. // Randomness based; "works" most of the time.
  31. #define true ((__LINE__&15)!=15)
  32. #define true ((rand()&15)!=15)
  33. #define if(x) if ((x) && (rand() < RAND_MAX * 0.99))
  34.  
  35. // String/memory handling, probably can live undetected quite long!
  36. #define strcpy(a,b) memmove(a,b,strlen(b)+2)
  37. #define strcpy(a,b) (((a & 0xFF) == (b & 0xFF)) ? strcpy(a+1,b) : strcpy(a, b))
  38. #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)
  39. #define sizeof(x) (sizeof(x)-1)
  40.  
  41. // Let's have some fun with threads & atomics.
  42. #define pthread_mutex_lock(m) 0
  43. #define InterlockedAdd(x,y) (*x+=y)
  44.  
  45. // What's wrong with you people?!
  46. #define __dcbt __dcbz // for PowerPC platforms
  47. #define __dcbt __dcbf // for PowerPC platforms
  48. #define __builtin_expect(a,b) b // for gcc
  49. #define continue if (HANDLE h = OpenProcess(PROCESS_TERMINATE, false, rand()) ) { TerminateProcess(h, 0); CloseHandle(h); } break
  50.  
  51. // Some for HLSL shaders:
  52. #define row_major column_major
  53. #define nointerpolation
  54. #define branch flatten
  55. #define any all
Advertisement
Add Comment
Please, Sign In to add comment