|
|
|
|
|
by ajross
5347 days ago
|
|
Mild quibble: the attribute you want is "pure", not "const". The distinction is that a const function inspects nothing but its arguments, but a pure function is allowed to read (but not write) external memory. Both are without side effects and can be optimized out of loops, but pure is looser. Not all const functions can be pure. |
|
A pure function is still allowed to allocate memory, though, and throw an exception.