RE: Custom error message for stack overflow in C++
August 26, 2021 at 11:59 am
(This post was last modified: August 26, 2021 at 11:59 am by HappySkeptic.)
(August 25, 2021 at 3:32 pm)FlatAssembler Wrote:(August 23, 2021 at 4:32 pm)HappySkeptic Wrote: The initialization may be fast with some compilers, but it cannot be optimized away.
Why?
You are telling the code to do the initialization work when constructing each new instance of the TreeNode class. The compiler MUST force the program to do that work, because it cannot assume the data has not changed since the last time the work was done.