3 ms·
Sorry, I should have been more specific. C/C++ const has no effect on optimization, unless it's on a global/static object and the compiler can see the original
by brigade 13y ago
Sorry, I should have been more specific.
C/C++ const has no effect on optimization, unless it's on a global/static object and the compiler can see the original declaration.
I'm not going to look it up in the C++ spec, but in C it's only undefined behavior if the original object was const, and it would make sense for C++ to be the same.
- caf 13y agoIt doesn't matter whether it's static or automatic storage duration.