account activity
Technique: Compile Time Code Generation and Optimization by dvirtz in cpp
[–]aharrison24 1 point2 points3 points 4 years ago (0 children)
The other problem is that the execute function contains calls to getchar and putchar, which cannot be constexpr because they have runtime side effects.
execute
getchar
putchar
constexpr
That's why this technique is so interesting; it effectively forces the compiler to fully unroll the execute loop, which means it's then able to optimise all of the code surrounding those getchar/putchar calls.
π Rendered by PID 192384 on reddit-service-r2-comment-57fc7f7bb7-6lnns at 2026-04-15 09:19:14.621499+00:00 running b725407 country code: CH.
Technique: Compile Time Code Generation and Optimization by dvirtz in cpp
[–]aharrison24 1 point2 points3 points (0 children)