[fpc-pascal] Inline bytes
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Aug 9 15:51:10 CEST 2012
Rainer Stratmann wrote on Thu, 09 Aug 2012:
> Am Thursday 09 August 2012 15:33:52 schrieb Jonas Maebe:
>> > Thanks, the next problem then is: I wanted to do that in an inline
>> > procedure but if the compiler detects an asm statement then inline is
>> > disabled(!).
>>
>> That's correct, it is not possible inline assembler statements in FPC.
>> You can try a macro instead:
>>
>> {$macro on}
>> {$define IReallyKnowWhatIAmDoing:=asm .byte 0x1f, 0xef, 0x1a end}
>>
>> begin
>> IReallyKnowWhatIAmDoing;
> Sounds good!
>> end.
>
> Same thing: inlining disabled(!).
The idea is to use the macro instead of a function call, not to use
the macro inside a function that you then try to inline. A macro is
just text substitution, it will never have a different effect than
typing its contents directly at the place where the macro is used.
Jonas
More information about the fpc-pascal
mailing list