[fpc-devel] function overload ?

Den cyraid at gmail.com
Mon Feb 3 15:44:26 CET 2014


If you're not worried about the slight speed hit and extra space on the 
stack for the return value of "My" you could always have it as a Variant?

   function My(const a : Integer) : Variant;

Then assign it to whatever variable?

- Dennis Fehr


On 14-02-03 12:54 AM, Gennadiy Poryev wrote:
> Hi!
>
> I had a dream :)
> Wouldn't it be nice if a function overload took care not only of 
> formal parameter list (per docs) but also of result type? So the 
> following may work
> function My(const a : Integer) : AnsiString; overload;
> function My(const a : Integer) : WideString; overload;
> by substitution of the function depending on the expected type of the 
> expression it is being called from?
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list