LWN.net Logo

GCC 4.6.0 released

GCC 4.6.0 released

Posted Apr 11, 2011 12:27 UTC (Mon) by etienne (subscriber, #25256)
In reply to: GCC 4.6.0 released by dtlin
Parent article: GCC 4.6.0 released

GCC treat const variable as thing which cannot be modified by the code, i.e. more like read-only.
You can modify the const variable in assembler, or in another piece of code where that variable is not declared "const".
Long time ago I read that you could use "static const" in C++ to get the same behaviour but I then tried and the variable was still defined as a piece of memory - and that was not available to C.
What I would like is that no memory is ever reserved for "inline const struct {}" - so the tests are always either true or false at compilation time, address of that variable cannot be taken, etc...


(Log in to post comments)

GCC 4.6.0 released

Posted Apr 11, 2011 20:05 UTC (Mon) by jrn (subscriber, #64214) [Link]

const register? constexpr?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds