[fpc-devel] 019605: Safety check for "const s: string" (similar to Range or Overflow checks)
florian at freepascal.org
Thu Jun 23 22:22:15 CEST 2011
May I propose a more generic solution:
- with some switch (-gc?) a call to checkpointer is inkoved at the end
of a procedure for const ref. counted types. Together with -gh this
catches the common case:
s : string;
procedure Foo(const s: string);
pbyte(s)^:=1; // force checkpointer call on s for testing purposes
If this is not enough
- we can introduce a compiler switch (or reuse an existing) which builds
a checksum on the relevant data of a const parameter on function entry.
At function exit, this checksum is checked.
More information about the fpc-devel