Const on the call site?

0ffh frank at frankhirsch.bogus.net
Wed Nov 14 01:54:05 PST 2007


Robert Fraser wrote:
> Thoughts?

I think it's possible, if you have all source code of
the project you are compiling.
Then again, object files could be annotated to show
which functions do not try to change which parameters.
So it would be possible, as long as you do not try
to use any libs which are do not support this kind of
meta-information. Including OS calls, which is kind
of a bummer. But then again, you could wrap them in
functions that use const in their declaration again
to indicate that even while the compiler is not able
to follow the code from there on, the coder guarantees
that the thing will not be changed...

So in principle, I think, the approach is viable.

Regards, Frank



More information about the Digitalmars-d mailing list