[fpc-pascal] Name of a var

Rainer Stratmann RainerStratmann at t-online.de
Tue Nov 22 00:04:47 CET 2011


Am Monday 21 November 2011 20:06:10 schrieb Jeppe Græsdal Johansen:
> Den 21-11-2011 13:56, Rainer Stratmann skrev:
> > 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'.
>
> It would most likely be very easy to implement, but what is the need?

I am storing vars in a textfile like:

mintemp: 300
maxtemp: 350

And so on ...

I put the pointer to the var and the savetext (the same name as the var) in an 
array wich describes all the vars. When saving all vartexts are written and 
then the values.
It would be easier then to detect double names for example. The compiler does 
it then.



More information about the fpc-pascal mailing list