▲ | two_handfuls 6 days ago | |
Probably but that would slow down compilation a lot. | ||
▲ | simlevesque 6 days ago | parent | next [-] | |
Exactly, it's not like the constants are gonna change. | ||
▲ | blharr 6 days ago | parent | prev | next [-] | |
You wouldn't have to recompile them every time. What if you didn't necessarily use macros but auto-generated it in a file that you keep separate from the other code at the bottom? | ||
▲ | dataflow 6 days ago | parent | prev [-] | |
What I would do in these cases is to define the general computation function, but special-case it to return the hard-coded value for specific common inputs if it's being evaluated at compile time. Then add a test to verify both behaviors. |