Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-11

How to translate C macros which use stringification?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gabor Boros

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

Reply by email

Ryan Joseph
to Gabor Boros
On Nov 23, 2019, at 2:47 AM, Gabor Boros wrote: 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.

99% certain this can't be done. I don't even think there's RTTI for local variable names but I could be wrong.

Regards,
Ryan Joseph

Reply by email