There was a problem with the "F" revision, make sure you have downloaded "G". Anyway...
> Could you elaborate a bit on the new string functionality in 1.0.0.2
By default, if you declare a string it is 32 characters long plus null terminator. In the past this was fixed, so if your string went over this number you needed to dimension it explicitly. This can be problematic as sometimes it's not always obvious that a string will go over the character limit. It can also be very problematic for strings passed by value. Parameter variables are adjusted to accommodate the largest string passed to it, but don't get re-dimensioned in the sub or function itself. For example,
- Code: Select all
sub mySub(str as string)
str = "string is : " + str
console.write(str,13,10)
end sub
sub main()
mySub("hello world")
end sub
here the parameter "str" is dimensioned to the length of "hello world". However, it can be seen that "str" needs to grow inside the function to accommodate the concatenation (remember that Firewing uses a compile time stack, not runtime, so it must calculate the max size of string at compile time). In previous versions of the compiler, this would almost certainly cause serious problems at runtime. The above is a fairly obvious example, but in some cases it's not always obvious that a string will extend beyond its dimensioned bounds.
The latest version of the compiler gets around this problem by "extending" the size of the string, if an expression assigned to it is likely to go beyond its original size. It also makes it easier to write code such as
- Code: Select all
dim str as string = "this is my very long sentence which will automatically increase the size of the declared string"
This addition should make for much more robust code. Note that extreme use of string concatenation will increase the size of the stack used over previous compiler versions (i.e. more RAM used) but because the stack is recycled, this should not cause any difficulties. Also note that you still need to take care when passing string "byref" - that is, make sure that they are dimensioned correctly
before you pass them by reference.