I believe that your code is being interpreted as:

(NOT fmt[i]) in ['0'..'9']

instead of the intended NOT (fmt[i] in ['0'..'9'])

Pascal's rules for parsing logical expressions differ from the standard rules of the 
propositional calculus (i.e. modern symbolic logic). Thus, this behavior is "by 
design" -- you'll have to use those extra parens -- and don't bother filing a bug.

Incidentally, I happen to agree with your assesment that this is a bug, in the 
philosophical sense -- but it was designed that way by Nicklaus Wirth, so we're stuck 
with it. It's one of a few flaws in what's really a very beautiful programming 
language.

~David.




At 10:46 PM 9/28/04, you wrote:
>I don't know if this is really a bug or whether it's known... I have
>this line of code:
>
>  while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do
>inc(i);
>
>It compiles fine but I get a RTE:
>
>An unhandled exception occurred at 0x0807B180 :
>EVariantError : Invalid variant operation
>  $0807B180
>  $BFFFF980
>
>Funny thing is, I enabled line numbers with '-gl'... And the error
>message makes no sense to me.. After staring at that line of code for
>a while, I put parens around the "fmt[i] IN ['0'..'9']" and all was
>well:
>
>  while ( (i<=Length(fmt)) and (NOT (fmt[i] IN ['0'..'9'])) ) do
>inc(i);
>
>So, that seems to be a bug to me... Shall I report it or is it known
>(or am I wrong that it's a bug)?
>
>-Alan



_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to