Richard D. Jackson wrote:
When using a plain String I'm getting this warning
warning: missing string capacity -- assuming 255
Getting rid of this warning for Var's is not a problem as I just do:
mystring : String (some number);
But how do you get rid of the warning when a function returns a string such as this:
function foobar( test : Integer): String;
I have tried to add a capacity argument to String but then I get this error:
parse error before '('
So the question is how can you assign the capacity to a String type when you are returning it from a function? I would prefer to not have to make a type for this if possible.
You'll have to do exactly this, I'm afraid. E.g., the `GPC' unit defines a type `TString' which it uses for all string function results.
Also while on the subject of strings are gpc strings protected against buffer overruns?
Modulo possible bugs, yes. (But I don't know if anyone has run extensive tests, so if you want to do this, I'll try to fix any bugs you might find ...)
Frank