Advertisement
atomen

Simple example...

May 5th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. // Include files
  2. #include <vector>
  3.  
  4. struct Type
  5. {
  6.     int size;
  7.     bool pointerOrReference;
  8. }
  9.  
  10. int main(int argc, char * argv[])
  11. {
  12.     // The vector for all arguments
  13.     std::vector<Type> arguments;
  14.  
  15.     // Fill it up with miscellanous arguments
  16.     // ....
  17.     // ....
  18.  
  19.     // Then if I want to calculate the amount
  20.     // I want to 'push' the stack, would this
  21.     // be enough, or does it grow deeper than this?
  22.  
  23.     int sizeToPush = 0;
  24.  
  25.     for(int i = 0; i < arguments.size(); i++)
  26.         sizeToPush += arguments[i].size;
  27.  
  28.     // And perhaps align the size here... (to a power of 2)
  29.     sizeToPush += (sizeToPush % 2);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement