Adam Naumowicz wrote:
It's not a bug. `String' is a schema type which adjusts to the actual parameter. In this case it has a capacity of 1 (since the value passed is a constant, the capacity is set equal to its length). So assigning anything longer will not fit.
Thanks, I suspected that it can be a "feature", but since there was no error/warning (knowing the strict rules of GPC parameter type checking), I expected it to make a full assignment. I strongly feel that a warning is due here.
It's strictly typed. That's jsut the behaviour of schema types. I don't see what we could warn about (or when -- generally warning about assignments to value parameters would be far too broad I suppose).
Perhaps there should be an (optional) runtime check on the assignment instead of silent truncation, though.
I just forgot what was the actual realization of GPC string schema and imagined that Chars is a POINTER to a char array which is dynamically allocated when necessery. A bit like FPC/Delphi Ansistrings with which all the low-level conversion stuff is done transparently for all string-like type assignments...
No, the string schema is not like that. We might add such a type in the future, but not now.
Frank