Your answer seems to imply that lazarus an not the compiler is creating this hint; is that correct?No its generated by the compiler. I just mentioned lazarus as a short term for lazarus and fpc.
In certain conditions (not in your example) simply only doing SetLength(DynArr, ALength) will give you unexpected results.There is the case where if the array previously contained data, that data will be copied. So if it contains something like managed records that do non lazy copy, this might result in massive overhead. Other than that, the only thing I can think of is that this may result in already having values in your array and not just the default. But maybe I'm missing something
When you call SetLength you don't need to initialize the array before hand. SetLength ensures the uniqueness of the array (lazy copy behavior), so no matter what could have been done previously to that array, as long as you don't care what is written into the array there is no need to initialize an array before calling setlength.
1 2 3
1 2 3 0 0