Lawyers or not, well-defined behaviour can only be a good thing for a language. As for those code snippets in the VCL and the like, unless we want to change the rule so that the for-loop counter has a distinct value afterwards, Result should be explicitly set after the for loop (presumably people want "High + 1").
What's the easiest solution to this? Change the code or change the rule? Gareth aka. Kit On Fri 18/05/18 12:46 , Mattias Gaertner nc-gaert...@netcologne.de sent: On Fri, 18 May 2018 13:28:30 +0200 (CEST) mar...@stack.nl [1] (Marco van de Voort) wrote: >[...] > > > "After the for statement terminates (provided this was not forced by a Break or an Exit procedure), the value of counter is undefined." >[...] > Well, well, clearly. One could interpret it that it says that the for > statement terminates naturally if not forced by break or exit. It doesn't > say what happens with break or exit. If the value of counter is undefined no matter what, then you would not bother writing the exception in the brackets, wouldn't you? > The fact that this exception is not documented with an example makes it very > ambiguous IMHO. I found a dozen places in the VCL using this. For Result:=...do if ... then exit; Mattias _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org [2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [3]" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: ------ [1] mailto:mar...@stack.nl [2] mailto:fpc-devel@lists.freepascal.org [3] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel