[fpc-pascal] Label

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Aug 9 16:52:40 CEST 2012


Sven Barth wrote on Thu, 09 Aug 2012:

> Am 09.08.2012 15:35, schrieb Jonas Maebe:
>>
>> Rainer Stratmann wrote on Thu, 09 Aug 2012:
>>
>>> Is it possible to get the adress of a label in a procedure?
>>
>> Not outside that procedure, no.
>
> Just because it sounds that way: is it possible inside the procedure?

Yes, if the label declaration is also inside the procedure. You can  
only take the address of a globally declared label iff
a) the label is also defined in the global scope ("begin .. end.",  
initialization, finalization)
b) the label's address is also taken in one of those blocks. It  
doesn't have to be the same one though, because the compiler keeps the  
code for all of those blocks in memory at the same time and hence a  
label defined in one of those is still valid while generating the code  
for another one. That's more a compiler implementation aspect than a  
conscious design decision though


Jonas



More information about the fpc-pascal mailing list