On 09/07/2011 00:09, Max Vlasov wrote:
The answer is indirect referencing. it's a workaround that probably
will solve the problem, but I must admit that I don't know what is the
exact performance price. The compiler when it detects const s:
ansistring could switch to passing not the actual address of the
string, but the address of the variable that holds it. In other words
passing PString instead of string. In this case no reference counting
or exception frame is probably created and at the same time, if the
used string is reallocated occasionally because of a side change, the
code will not fail because it will just automatically use the new
modified address.


function CRCConstString(constref Str: string): integer;

does what you describe

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to