Question 7: Default parameter values: C++ and Lisp [6]

This semester we discussed the use of default parameter values in both C++ and lisp. An sample function and call for each is shown below, where the function squares its input.

 float f(float = 0);
 int main() {
    float x = f();
    float y = f(1);  
 }
 float f(float a) {
    return a*a;
 }

 (defun f (&optional (a 0))  
    (if (realp a)
           (* a a)
            nil))

 (defvar x (f))

 (defvar y (f 1))

Compare the two approaches to supporting default values, identifying the advantages/disadvantages (if any) of each approach.