Code readthrough, comments
bisqwit opened this issue · comments
I had a brief read through your cons_expr.hpp
. Fascinating code. Assorted comments below:
Category: Great idea!
— [[nodiscard]]
attribute on ++(int)
, --(int)
, begin()
etc.
Category: Could be better?
— pow()
: Could use the much more efficient binary exponentiation algorithm: for(result = 1; power != 0; power >>= 1, base *= base) if(power & 1) result *= base;
(similarly /=
for negative exponents)
Category: Why the discrepancy?
— pow()
: Parameter is long long, but is iterated using int.
— parse_float()
: Accepts "-.4"
but not ".4"
.
— parse_float()
: Accepts "13.4e2"
and "13.4e-2"
. Accepts "13e2"
but not "13e-2"
.
Category: Errors?
— parse_float()
: Accepts "-e2"
.
— next_token()
: Interprets both "a\"b"
and "a\\"b"
as valid string constants.