If a large const array or struct is on the stack, make it static const so that the data does not have to be populated on the stack each time a function is entered. I keep on finding these in the kernel.
Why doesn't the compiler do this already? Putting it on the stack violates "const" intentions too.
-
-
If one looks at the object code size after adding the static one can see the data segment size increases and text segment decreases, so probably not. Looks iffy to me.
-
https://gist.github.com/kees/4a72681d1b56c08e294872260233243c … This is what I mean: only the "static const" is actually read-only. I think locally declared const should be automatically made static. Maybe I'm missing something where this would break things?
-
Time for me to re-read the ANSI standard again methinks
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.