Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code readthrough, comments #7

Open
bisqwit opened this issue Jun 7, 2023 · 0 comments
Open

Code readthrough, comments #7

bisqwit opened this issue Jun 7, 2023 · 0 comments

Comments

@bisqwit
Copy link

bisqwit commented Jun 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant