title: How do I mark code with side effects?
body: <p>I'm working on a project on an 8051 where every byte counts.  As such, I am using some global variables where I normally wouldn't.  The normal method of passing pointers into a function adds too much overhead here.</p>
  
  <p>I have a number of functions that use single bit variables (a compiler specific extension to <strong>C</strong>) to signal the outcome of a function in addition to the normal return value.</p>
  
  <pre><code>bit global_error_flag = 0;
  bit global_data_ready_flag = 0;
  
  unsigned char A_Function (void) {
      // Do some stuff
  
      if ( badness ) {
          global_error_flag = 0;
          global_data_ready_flag = 1;
  
          return 0;
      }
  
      if ( data_is_ready_use ) {
          global_data_ready_flag = 1;
      }
  
      return a_value;    
  }
  
  void Other_Function (void) {
      unsigned char c;
  
      c = A_Function();
  
      if( global_error_flag) {
          // Do error stuff here.
      }
      else
      if( global_data_ready_flag ) {
          // Do data processing here.
      }
      global_error_flag = 0;
      global_data_ready_flag = 0;
  
  }
  </code></pre>
  
  <p>Given that the technique is evil, is there some way I can make the code clearer?</p>
  
  <p>How best should I indicate which function calls will have the side-effect of setting these flags?  Are comments enough?  Should I name the functions to indicate their API (quasi-hungarian-style)? Should I use a macro to mark such calls:</p>
  
  <pre><code>#define FUNCTION_SETS_FLAGS(code) (code)
  
  FUNCTION_SETS_FLAGS( c = A_Function() );
  </code></pre>
  
  <p>Any other ideas?</p>