I’m curious about the usage of “const” as parameters in methods and functions of JUCE, where the parameter will not change - in implementation files, and “seemingly spuriously” in headers. Does anybody know if doing provides an advantage (ie: readability, affecting code generation) - or is it a stylistic preference?
Take for example juce::Array::ensureStorageAllocated:
The parameter does not change in the method, and is therefore “const.” Though, the guarantee of it not being modified is self-explanatory - therefore does not “need” to be const (unless there’s something I’m not seeing at a glance)…