Hi
I have a function "myFunc" which takes 1 parameter (Text,5) by reference. When this function is called with a parameter exceeding the length of 5 I would expect an error (overflow). This does not happen.
Is this a kind of a bug or is this by design? Is it safe to call the function without regarding the length of the parameter?
Many Thanks
Thomas
0
Comments
Commonly there is error "The length of the source exceeds the size of the destination buffer."
But only if the Value is longer, not the data type...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I'm using Version 3.7
I also know the message "The length of the source exceeds the size of the destination buffer." , but I can't reproduce this message. What's the difference between this message and the message "Overflow"?
Thomas
It seems, that the error about buffer is when size of parameters is longer than some stack size...
If I pass only longer string, there was Overflow error.
Do not forget, that you can have only 20 parameters in one function and may be there is some limit for size of all passed values (stack size)...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
It seems, that the "Buffer" error is produced when using Text Constants; the "Overflow" error is produced when using Text Variables.
Anyway, do you have experiences with functions calls by ref (using longer parameters than defined)?
Regards
Thomas
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I dont understand this "only if you assign bigger value than passed variable size..."
there will be error, but when I assign only '1234567890' it will be ok (the Param is Text[1], but it takes it as Text[10]);
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Do you think it's save to use longer parameters than defined? Anyway, I think its quite dangerous, because no error is produced.
Thomas
example:
In this case, if the C/SIDE will check for the limit of the parameter type, it will write outside of the passed variable... Param is only pointer to the Text1 variable... C/SIDE correctly test for the limit of Text1...
In this way, it is first example of dynamic variable in C/AL code...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Its ok for me now, thank you again for your input.
Thomas