[fpc-devel] 019605: Safety check for "const s: string" (similar to Range or Overflow checks)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Jun 24 06:34:19 CEST 2011


Martin schrieb:

> Fetching content changes, would require to either copy or checksum 
> *every* const param => that is a different beast (one that I did not 
> propose...)

Content changes in structured types (TObject!) are not prevented by the 
"const" modifier.

While such a restriction is one of the many meanings of "const" in C++, 
and could be implemented in the same way in OPL, too, it would require 
so many changes to existing code, that I discourage every such attempt 
in OPL. Consider the proper separaration of const/non-const methods in 
every class, with possibly dual implementations of the same methods :-(

DoDi




More information about the fpc-devel mailing list