[fpc-pascal] Name of a var

Rainer Stratmann RainerStratmann at t-online.de
Mon Nov 21 14:08:32 CET 2011


Am Monday 21 November 2011 14:08:43 schrieb michael.vancanneyt at wisa.be:
> On Mon, 21 Nov 2011, Rainer Stratmann wrote:
> > Is it possible to get information of the name of a var?
> >
> > For Example.
> >
> > var
> > counter : longint;
> > varname : shortstring;
> >
> > varname := nameofvar( counter );
> >
> > The content of varname then is 'counter'.
>
> There is no way in Pascal.
I think all the necessary information for this function are available.
The compiler knows the names of all vars. So why shouldn't it be possible to 
put the name in a shortstring?
> Conceivably, you can make such a function that 
> returns the name when debug info is included in the binary.
Or put only the specific information when the compiler detects this function 
to avoid saving all vars.
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list