NicTheQuick wrote: Tue Jan 27, 2026 11:51 am
But isn't that what "in place" means? The help page even says that the return value needs to be ignored when `#PB_String_InPlace` is used.
Yes. The procedure Modify() performs an in-place replacement on the
local string "String.s", therefore ReplaceString has no return value.
But as the new PB version now passes the string (internally) by-ref by default, instead of by-value, this replacement is also happen in the caller-procedure Test() where the String is passed by-value to the procedure Modify(), because the modification of the string was not tracked.
Fred wrote: Tue Jan 27, 2026 1:21 pm
It's the only function of the whole PB commandset to allow this and I don't think it's wise to keep it. It was done when computer were slow to gain a bit of speed, but now it doesn't worth it, as it can introduce bad overflow bugs.
It is your decision to keep it (and fix it) or to remove #PB_String_InPlace.
However, it is a good example to show how dangerous it could be to pass strings internally by-ref and only copy them on modifications, if the modification is not noticed. Please don't misunderstand me, I like the new method, because it is much faster! But you must ensure that all modifications are securely tracked.