Personally, I always write
if Assigned(List) then
but not
if List<>nil then
because I believe that it reads better, and not just for dynamic arrays.
Answers the question about dynamic arrays, but your example is an open array, so there are two possible questions here.
For open arrays, I would use Length() or high() to make a decision based on the size of the array. I would not be tempted by the arguments that Pointer(List)<>nil faster than Length(List)<>nil . The difference in speed between these parameters will not be distinguishable, so you should use the most understandable and understandable option.
David heffernan
source share