Guest User

Untitled

a guest
Apr 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. int x = some_bool ? printf("WTF"), 5 : fprintf(stderr, "No, really, WTF"), 117;
  2.  
  3. a = rand();
  4. ++a;
  5. b = rand();
  6. c = a + b / 2;
  7. if (a < c - 5)
  8. d = a;
  9. else
  10. d = b;
  11.  
  12. a = rand(), ++a, b = rand(), c = a + b / 2, a < c - 5 ? d = a : d = b;
  13. a = rand(), ++a, b = rand(), c = a + b / 2, d = a < c - 5 ? a : b;
  14. d = (a = rand(), ++a, b = rand(), c = a + b / 2, a < c - 5 ? a : b);
  15. a = rand(), ++a, b = rand(), c = a + b / 2, (a < c - 5 && (d = a, 1)) || (d = b);
  16.  
  17. #define SomeMacro(A) ( DoWork(A), Permute(A) )
  18.  
  19. while (cin >> str, str != "STOP") {
  20. //process str
  21. }
  22.  
  23. class X : public A {
  24. X() : A( (global_function(), global_result) ) {};
  25. };
  26.  
  27. class NamedMutex : public boost::timed_mutex
  28. {
  29. public:
  30. ...
  31.  
  32. private:
  33. std::string name_ ;
  34. };
  35.  
  36. void log( NamedMutex & ref__ , std::string const& name__ )
  37. {
  38. LOG( name__ << " waits for " << ref__.name_ );
  39. }
  40.  
  41. class NamedUniqueLock : public boost::unique_lock< NamedMutex >
  42. {
  43. public:
  44.  
  45. NamedUniqueLock::NamedUniqueLock(
  46. NamedMutex & ref__ ,
  47. std::string const& name__ ,
  48. size_t const& nbmilliseconds )
  49. :
  50. boost::unique_lock< NamedMutex >( ( log( ref__ , name__ ) , ref__ ) ,
  51. boost::get_system_time() + boost::posix_time::milliseconds( nbmilliseconds ) ),
  52. ref_( ref__ ),
  53. name_( name__ )
  54. {
  55. }
  56.  
  57. ....
  58.  
  59. };
  60.  
  61. int a, b, c;
  62.  
  63. int a, b, c;
  64. for(a = 0, b = 10; c += 2*a+b, a <= b; a++, b--);
  65. printf("%d", c);
  66.  
  67. #define malloc(size) (printf("malloc(%d)n", (int)(size)), malloc((size)))
  68.  
  69. delete p, p = 0;
  70.  
  71. using namespace boost::assign;
  72.  
  73. vector<int> v;
  74. v += 1,2,3,4,5,6,7,8,9;
  75.  
  76. foo=bar*2, plugh=hoo+7;
  77.  
  78. foo=bar*2;
  79. plugh=hoo+7;
  80.  
  81. if (a==1)
  82. ... do something ...
  83. else if (function_with_side_effects_including_setting_b(), b==2)
  84. ... do something that relies on the side effects ...
  85.  
  86. void* s_static_pointer = 0;
  87.  
  88. void init() {
  89. configureLib();
  90. s_static_pointer = calculateFancyStuff(x,y,z);
  91. regptr(s_static_pointer);
  92. }
  93.  
  94. bool s_init = init(), true; // just run init() before anything else
  95.  
  96. Foo::Foo() {
  97. s_static_pointer->doStuff(); // works properly
  98. }
  99.  
  100. int ans = isRunning() ? total += 10, newAnswer(total) : 0;
  101.  
  102. #define ASSIGN_INCR(p, val, type) ((*((type) *)(p) = (val)), (p) += sizeof(type))
  103.  
  104. if (need_to_output_short)
  105. ASSIGN_INCR(ptr, short_value, short);
  106.  
  107. latest_pos = ASSIGN_INCR(ptr, int_value, int);
  108.  
  109. send_buff(outbuff, (int)(ASSIGN_INCR(ptr, last_value, int) - outbuff));
  110.  
  111. ASSERT(("This value must be true.", x));
Add Comment
Please, Sign In to add comment