2 ms·
Already changed that to "is rarely truly constant". Also, that flash can be written, even if not during the lifetime of a process. > That's also why you want t
by jstimpfle 5y ago
Already changed that to "is rarely truly constant". Also, that flash can be written, even if not during the lifetime of a process.
> That's also why you want to use const whenever possible so you are not wasting precious RAM.
My point is to not overthink placement of "const" in function parameters, local variables, etc. Because those don't make any difference to the compiled output. I already mentioned string literals as one type of "reasonably constant" data, and of course any other thing that goes in the .rodata section (such as globally declared const variables) is as much constant.
To wrap it up, the "const" keyword totally makes sense in global declarations to make them go to .rodata. Using const for type-checking purposes can get quirky on the other hand.