question - optimization and const

Dima Sorkin dima.sorkin@gmail.com
Wed Aug 15 08:51:00 GMT 2007


Hi.
 The english of my prev message was awfull, I try
to improve it here:

In C++, when I denote a formal parameter of a function
as "const", it means that that parameter is read only.

Now suppose that inside a function I change the value
of it's const argument temporarily, but always restore
the original value of the argument at return. I can do it
via const_cast or via call to external (non c++) code.

question:
1) Does optimization process of g++ looks at "const"s
    at all ?
2) If yes, can the action of changing const arguments
    bring to incorrect code.

Thank you.
 Dima.



More information about the Gcc-help mailing list