|
|
|
|
|
by pjmlp
1520 days ago
|
|
That is why main() has a static constexpr, to force its execution at compile time. A trick I learned from Jason's screencasts. Although, you're right. I tried it back at home on VC++ and its static analyser wasn't happy. My idea was to make use of template metaprogramming to generate the string buffer, there are a couple of examples of such attempts. However, I guess with such amount of additional code, I should declare defeat on the original comment. |
|
In languages where you can't tell the compiler you think this is constant, there's a risk you delude yourself, especially because computers are very fast, and you think you've got O(1) when it's actually O(N) or even O(N^2) and one day N gets big enough and you're in real trouble.