Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 1.16 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Is there a better way to comment the parameters' direction in code?
  2. #define IN
  3. #define OUT
  4.  
  5. void Add(IN int Para1, IN int Para2, OUT int& Result);
  6.        
  7. void foo(int i, const std::string& s, std::vector<char>& out_buf);
  8. // i and s are obviously "in" variables, while out_buf could be both,
  9. // but you can easily show that by giving the parameter a proper name.
  10.        
  11. void Add(/*IN*/ int Para1, /*IN*/ int Para2, /*OUT*/ int& Result);
  12.        
  13. /*Description : Function for adding the two variables.
  14.         * Returns : Nothing
  15.         * Parameters : Para1 and Para2  are **IN** parameter and
  16.         * Result is an **OUT** parameter
  17.         * @author : <put ur name here>
  18.         */
  19.     void Add(IN int Para1, IN int Para2, OUT int& Result);
  20.        
  21. void Add(int inPara1,int inPara2,int& outResult);
  22.        
  23. void Add(
  24.     /* input parameters */
  25.     int Para1,
  26.     int Para2,
  27.     /* output parameters */
  28.     int& Result
  29. );
  30.        
  31. void f(int x);
  32.        
  33. void f(const Foo& read_only_foo);
  34.        
  35. void f(int& x);
  36.        
  37. ostream& operator<<(ostream& os, const Foo& foo);
  38.        
  39. // fills the specified list with stuff
  40. void some_list(list<int>& out_list);
  41.        
  42. // returns a new list filled with stuff
  43. list<int> some_list();