Hi Peter, on 2005-03-24T12:55:21+02:00 Peter wrote:
>> I don't know, whether other compiler modes support const and out. >> If yes, the RTL/FCL/LCL functions should use it. This do mean e.g. > For compatibility we can't do this. Delphi also doesn't warn. This is not really a good argument. FPC generate several hints, which are not generated by Delphi and which are useful. > And making the warning dependent on the compiler mode will make > things too complex. Because it then dependents on the compiler mode > used to compile a used unit that contains a function and not on the > compiler mode used in the current unit. The problem is, that only the OBJFPC and Delphi modes support the out parameter. This prevent a simple solution. BTW: This need to be documented, at least in the Reference guide Chapter 10 (Using functions and procedures / Parameter lists / Out parameters), maybe in the Programmers manual too. The problem, you describe above could be solved relative simple, even the solution is more complex. I don't know any details of the compiler, but I assume, that internally the compiler use a identical structure to manage the parameter lists for all compiler modes. The compiler can analyse the function and determine, whether a var parameter is a in, a in/out or a out parameter and modify the parameter list corresponding. This enable to generate correct hints. As a side effect of such a analyse, FPC could generate hints regarding unneeded assignments, like in Delphi: var i: Integer; begin i := 1; <--- assigned value not used i := 2; ... And additionally the compiler could generate hints to change a var parameter to a const or out parameter in OBJFPC or Delphi mode. Because I know your standard answer and don't accept it, is there any suggestion list, similar to the bug list? wkr Peter. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal