Argument Passing

  • Strict Evaluation: evalulate the arguments, then call the function
  • 
                void fun(int x) { print fun }
                int arg() { print arg; return 2; }
                fun(arg());    // prints arg fun with strict eval
                
  • Parameter Passing
    • Pass By Value (PBV): copy in the value
    • Pass By Reference (PBR): make a brand new reference to the argument
    
                void foo(int x) { x = x + 2; }
                int w = 4;
                foo(w);
                print w // PBV prints: 4, PBR prints: 6
                
    Note: something in C++ is PBR!!