[fpc-pascal] Initializing constant (translate from C)
Sven Barth
pascaldragon at googlemail.com
Tue Oct 17 08:02:55 CEST 2017
Am 16.10.2017 21:36 schrieb "Darius Blaszyk" <dhkblaszyk at zeelandnet.nl>:
>
> Here's an interesting one. In C I have this code:
>
> #define ID1 MAKE_ID('A', 'B')
>
> Where MAKE_ID is a macro that depending on the endianness of the target
will create either AB or BA.
>
> How would I be able to translate this into Pascal? ID1 preferably would
need to remain a constant. I tried using an inline function without
success. If all fails I will need to define them all individually using an
ifdef for different endian systems. But this would be my last resort.
Best use inline functions for both ID1 and MAKE_ID. The compiler should
optimize away the calls and do a constant concatenation.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171017/3b961a33/attachment.html>
More information about the fpc-pascal
mailing list