Mega Code Archive

 
Categories / Delphi / Examples
 

Return value of function xyz might be undefined

Question: I seem to be getting a bogus warning about an undefined function result. Can anyone confirm this? Answer: Both Delphi 5 and Delphi 6 will report: Return value of function Undefined2 might be undefined Delphi 7 will complain about Undefined1 as well. Return value of function Undefined1 might be undefined Return value of function Undefined2 might be undefined This is a bug in Delphi 7. program Project1; function Undefined1 : boolean; var b: boolean; begin { Undefined1 } Undefined1 := False; b := True; if b then Undefined1 := True end; { Undefined1 } function Undefined2 : boolean; var b: boolean; begin { Undefined2 } b := True; if b then Undefined2 := True end; { Undefined2 } begin end.