<div class="gmail_quote">2011/10/21 Tomas Hajny <span dir="ltr"><<a href="mailto:XHajT03@hajny.biz">XHajT03@hajny.biz</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 20 Oct 11, at 17:43, Andrew Pennebaker wrote:<br>
<br>
> It's inconsistent and ripe for bugs.<br>
<br>
</div>Array indices may start at any ordinal value (including e.g.<br>
characters, values of enumerated types, etc.), not just 0. Only<br>
dynamic arrays always start at 0 because that is how they have been<br>
"imported" from other languages.<br>
<font color="#888888"><br>
Tomas<br>
</font><div><div></div><div class="h5"><br></div></div></blockquote><div><br>As said by Thomas, I think we will have to get along with string[1].<br>However, since I stumbled upon the string[0] mistake more than once, I take the chance to suggest a way to reduce the likelihood of it.<br>
<br>During compilation, by statically checking the indices used to access the string, the compiler could fire a warning (or error?) if a string[0] is found.<br>I think that most of the times the string[0] happens inside a for loop or similar, so a good percentage of these mistakes can be caught.<br>
<br>R#<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div class="h5">
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br>