Alan Mead wrote 26 lines
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)?
Thanks for the comments. Perhaps I was unclear. There are three reasons I am inclined to consider this a bug.
First, it seems improper for any syntax to compile (i.e., to fail to raise a syntax error) and then not execute. Ok, "a := 1/0;" might compile but it seems like some type checking got lost here. Maybe there is am implicit conversion going on... At the least, I'd like the compiler to flag this line with a warning.
Second, I had to track this down by inserting a bunch of lines like "writeln('Passed 33');". The code was compiled with -gl so I should see a line number but none is shown. This seems like a bug.
Third, the RTE, "Invalid variant operation" seems inappropriate and confusing. Again, maybe there's an implicit conversion... (but is it appropriate?)
-Alan