简体   繁体   中英

How to make a Macro parser in C++ project

in the project, there are a lot of macros such as

#define a (b+c)
#define b (e+d)

sometimes you need to decide the actual value of a . so i am wondering if there are any tools for doing that, calculating all the macros and give the actual value as comment: (like below)

#define a (b+c)  //a = 5

Are there any opensource project related on this macro parsing job? thanx

I don't know how such a tool could exist as a macro may have an argument that is only known during execution(for instance #define sum(a,b) (a+b) ). As for the value during runtime - any reasonable debugger will handle that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM