| ▲ | Joker_vD 2 hours ago | |
> Usually this would be done via an interpreter, so I'm not sure that it really requires unsafe either. Well, I personally have written a const-expression evaluator that actually reuses the rest of the compiler: it compiles the expression in the current environment with some specific adjustments to the codegen settings, launches the temporary executable and gathers its output... frankly, it's more hassle than it's worth compared to writing a separate const-expression interpreter. Plus, of course, it also runs slower since most constant expressions are usually pretty trivial. | ||