[fpc-devel] 019605: Safety check for "const s: string" (similar to Range or Overflow checks)
fpc at mfriebe.de
Thu Jun 23 22:36:11 CEST 2011
On 23/06/2011 21:22, Florian Klämpfl wrote:
> 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:
Sorry I do not understand?
> s : string;
> procedure proc;
> procedure Foo(const s: string);
I assume the below is supposed to be the hidden / automatic check?
(since the above was the unwarranted change to s)
But what does it test (besides from being an assignment?
> 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