tom_at_work at gmx.at
Thu Aug 9 17:17:02 CEST 2012
On 08/ 9/12 05:08 PM, Rainer Stratmann wrote:
> 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
> If you have a label in a procedure and declare this procedure as inline
> procedure then it gives also problems (Fatal: compilation aborted!).
just fyi, generally the "inline" keyword is only a suggestion to the
compiler. There is no guarantee whatsoever that it will actually inline
that particular method. There are, as you found out, several limitations
for that. Actually, there are more, like size of the inlined method,
possible use of exception handling, etc. (I'm not sure about the exact
conditions btw, maybe there's some documentation in the manuals)
Do not use it if you code something that relies on actual inlining - it
seems to me that you require that in whatever you're trying to achieve.
Only macros are guaranteed to be inlined - because they are simple text
replacement instructions to the compiler.
More information about the fpc-pascal