[fpc-pascal] How to translate C macros which use stringification?

Gabor Boros mlnglsts at bgss.hu
Sat Nov 23 08:47:16 CET 2019


Hi All,

I made a simple example to demonstrate the problem:

#include <iostream>
using namespace std;

#define MACRO1(x)                        \
         cout << #x << "(" << (x) << ")"; \

int main()
{
     int var1;
     var1 = 44;	
     MACRO1(var1);
     return 0;
}

The result of this simple example on the screen is:
var1(4)

Can I do the same thing with FPC in a simple way? I translate some C 
source to FPC and try to follow the original code.

Gabor


More information about the fpc-pascal mailing list