Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

How to see (or check) values of macro function in C during debugging mode in MS visual studio?

I would like to check a numerical value evaluated by a function macro in C during debugging mode. I defined a function as macro like below.

#define H_H2(T)        0.2584e4*exp(170/(T))

When I tried to evaluate this function H_H2(298) during debugging mode at watch window in Visual studio, it generated an error identifier "H_H2" is undefined.

Could someone let me know how to evaluate a macro function during debugging mode ?

question from:https://stackoverflow.com/questions/65876222/how-to-see-or-check-values-of-macro-function-in-c-during-debugging-mode-in-ms

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can't. Macros are resolved during the preprocessor, and as a result they don't exist in compiled code.

If you need to debug such an expression, create a function, or step through the disassembled code (Ctrl+,G in VS2019).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...