How to translate C macros which use stringification?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to translate C macros which use stringification?

Gabor Boros-2
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to translate C macros which use stringification?

Free Pascal - General mailing list


> On Nov 23, 2019, at 2:47 AM, Gabor Boros <[hidden email]> 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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal