[fpc-pascal] Program needs probably the variants unit

Jan Jelowicki jasj at hydra.ar.wroc.pl
Thu Nov 2 14:41:32 CET 2006


I wrote accidentally the following line of pascal code:

   writeln(output, a + b);

where a was a double, and b was a string. The program compiled, linked 
successfully. Why?

Next, running it, I got the following:
Program needs probably the variants unit.
Include the variants unit in your uses statements
as one of the first units.

Runtime error 221 at $08053F3A

Well. But I do not like programs that try to be more intelligent 
than operator. double + string expression is lexical error from my
point of view, and always will be. I would prefer to detect them during 
compilation. What switches could enable that?
  -So is always on
  -S2 has no influence
  -Sd has no influence

With regards,
                                        Jan Je/lowicki
 		                       jasj at hydra.ar.wroc.pl
Department of Mathematics       Katedra Matematyki
University of Agriculture       Akademia Rolnicza we Wroc/lawiu
Wroc/law, POLAND

More information about the fpc-pascal mailing list