
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Added StringLen to the test, and initialized the string differently. The documentation says one thing, the actual behavior is different.
And buffer in this case shows 0 instead of 260.
The documentation specifies when 0 is returned and it is appropriate for the specified case
The documentation indicates when 0 is returned and is appropriate for the case indicated
The documentation does not match the current behaviour at all!
And the results are different ))What is the difference between the two types of initialisation?
And it's not clear where the left number 260 is coming from.
The documentation does not match the current behaviour at all!
Documentation: A value of 0 means that the string is a constant and the contents of the buffer cannot be changed.
The string is initialized with constant "_" and the compiler considers the string conditionally (for efficiency purposes) a constant - why not? Why is there a contradiction? All the more so because no further operations are performed with it.
And in general it is not clear where the left number 260 is coming from.
The moderator explained where it came from, and why it in the case of
does not appear - reason to check
The moderator clarified where from
I think I got it with number 260, the compiler itself allocates the initial size of theStringBufferLen buffer to 260.
If the string length is less than 260, the StringBufferLen will print 260, not the actual string length!
And if the string length is greater than 260, then the actual string value is printed.
So, using the StringBufferLen function, with a string length of less than 260 characters, we won't get the actual string length, and will always get 260.
This must be an error.
As soon as the length exceeds 260 characters, we will get the real string length.
p.s. as the documentation is out of date it is very misleading.
That is, using the StringBufferLen function, with a string length of less than 260 characters, we will not get the actual string length, and will always get 260.
This must be an error.
As soon as the length exceeds 260 characters, we will get the real length.
Strictly speaking string length: StringLen and buffer length: StringBufferLen are rather rare functions. And in general they may not coincide.
That makes two at least questionable cases:
The executionresults show that the compiler acts contrary to logic:
The executionresults show that the compiler acts contrary to logic:
Preallocation size of buffers for strings is an internal matter of the compiler.
We will change the handling of strings many more times.