>
> No, it's not just an example. It's actually a special case. You will not
> see the same warning with any other procedures that have "var" parameters.
> The Val procedure is a compiler-magic function. The compiler takes your
> code and rewrites it as this:


sorry !  i really took the bad example. I understand now..

You're right, with my test proc, i don't meet the problem anymore... :

procedure myTestProc(S: String; var ACode : Integer);
begin
  ACode := 1;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
  s: String;
  i : Integer;
begin
  myTestProc(S, i);  // i deliberately do not use "i" to test...
end;




>
>
> myCode := System._ValLong(S, myV);
>
> That's the code that the code-analyzer sees. It sees an assignment to the
> myCode variable, and when it does not see you use that variable, it issues
> its usual "assigned but never used" hint.
>
> Other code is _not_ rewritten like that, so there is no unused assignment
> statement to hint about.


Oh i understand now... very interesting...


>
>
> You can use something other than Val. You could use TryStrToInt, for
> example. Or, you could use both output parameters from Val. You mustn't
> ignore the Code parameter, anyway, since it tells you whether the Value
> parameter is meaningful.


Ok, i take note of this..

Thanks

Cédric
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to