diff options
author | Ted Yin <[email protected]> | 2013-08-07 09:50:35 +0800 |
---|---|---|
committer | Ted Yin <[email protected]> | 2013-08-07 09:50:35 +0800 |
commit | 1c0a3e34ab5c2a4208ae567c12381f84a44532f5 (patch) | |
tree | 00ee621f91856962a3720ff48a403dd06c76d0e8 | |
parent | 1b7d180a8af9b2bdb8f278c4ba9f24eb39cde779 (diff) |
a little fix
-rw-r--r-- | builtin.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/builtin.cpp b/builtin.cpp index e5e0614..b1d2a93 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -729,7 +729,8 @@ BUILTIN_PROC_DEF(make_list) { BUILTIN_PROC_DEF(num_add) { NumObj *res = new IntNumObj(0), *opr; // the most accurate type EvalObj *nptr; - for (Cons *ptr = args;;) + Cons *ptr; + for (ptr = args;;) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -757,7 +758,8 @@ BUILTIN_PROC_DEF(num_sub) { NumObj *res = static_cast<NumObj*>(args->car), *opr; EvalObj *nptr; - for (Cons *ptr = TO_CONS(args->cdr);;) + Cons *ptr; + for (ptr = TO_CONS(args->cdr);;) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -782,7 +784,8 @@ BUILTIN_PROC_DEF(num_sub) { BUILTIN_PROC_DEF(num_multi) { NumObj *res = new IntNumObj(1), *opr; // the most accurate type EvalObj *nptr; - for (Cons *ptr = args;;) + Cons *ptr; + for (ptr = args;;) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -810,7 +813,8 @@ BUILTIN_PROC_DEF(num_div) { NumObj *res = static_cast<NumObj*>(args->car), *opr; EvalObj *nptr; - for (Cons *ptr = TO_CONS(args->cdr);;) + Cons *ptr; + for (ptr = TO_CONS(args->cdr);;) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -839,8 +843,9 @@ BUILTIN_PROC_DEF(num_lt) { NumObj *last = static_cast<NumObj*>(args->car), *opr; EvalObj *nptr; + Cons *ptr; - for (Cons *ptr = TO_CONS(args->cdr);; last = opr) + for (ptr = TO_CONS(args->cdr);; last = opr) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -869,8 +874,9 @@ BUILTIN_PROC_DEF(num_gt) { NumObj *last = static_cast<NumObj*>(args->car), *opr; EvalObj *nptr; + Cons *ptr; - for (Cons *ptr = TO_CONS(args->cdr);; last = opr) + for (ptr = TO_CONS(args->cdr);; last = opr) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); @@ -899,8 +905,9 @@ BUILTIN_PROC_DEF(num_eq) { NumObj *last = static_cast<NumObj*>(args->car), *opr; EvalObj *nptr; + Cons *ptr; - for (Cons *ptr = TO_CONS(args->cdr);; last = opr) + for (ptr = TO_CONS(args->cdr);; last = opr) { if (!ptr->car->is_num_obj()) // not a number throw TokenError("a number", RUN_ERR_WRONG_TYPE); |