> 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
This is not possible when the parameter is passed as var parameter to another procedure that is external. > 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? Lucky enough not, because then ppl will start wishing everything. The two most important rules about fpc: - We need to have fun in making FPC - We have limited time When we don't like something or find it low priority like this don't expect anything from us. Sending a patch to implement the missing feature that you want will increase the chance that it'll be added to FPC. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal