<div dir="ltr"><div><div><div><div><div>Imagine I have this function:<br><br>procedure ArrayTest(const data : array of char);<br></div><div>begin<br> ...<br></div><div>end;<br></div><div><br></div>and in another routine I have a pchar variable. If I slice the array byte doing this:<br><br></div>ArrayTest(myPChar[0..99]);<br><br></div>then inside ArrayTest it will appear that data is 100 characters, which is exactly what I'd expect.<br><br></div>However, it surprised me that this syntax was accepted (with a dereferenced pchar):<br><br>ArrayTest(myPChar^);<br><br></div>as well as this syntax (with a simple char):<br><div><br>ArrayTest(myChar);<br><br></div><div>In both of those cases, ArrayTest thinks it's got an array of length 1.<br><br></div><div>My question is (and I know this is a long shot): is there some sort of compiler directive or directive I can include in my source code to disallow the syntax of my second and third examples, ie., to disallow passing a single element as an open array?<br><br></div><div>Thanks,<br><br></div><div>-SG<br></div><div><div><div><div><div><div><div><div><div><br>
</div></div></div></div></div></div></div></div></div></div>