Node: Order of Evaluation, Previous: Memory Leaks, Up: Programming Cautions



Order of Evaluation

In Lisp the order of evaluation of function arguments is strictly left to right. Sometimes this is important since successive argument evaluation may depend on earlier arguments. Unfortunately in C++ the order of evaluation is undefended. Therefore the programmer must not depend on this. For example in the following code

     let a = L(5);
     list(inc(a, a), dec(a));
     

the list function could return (10 9) or (8 4) depending on the C++ implementation. There is no standard guideline here other than to watch out for such order of evaluation problems and if necessary re-code in a different way.