|
Hello,
I've got a pretty complicated macro inside my (unmanaged) C++ code. Is there any way to expand macros in VS debugger? Or maybe there is another way to debug macros there?
F.e. I'd like to place a breakpoint inside it.
(Yes, I know macros are bad...
Started by liori on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Recompile and you should be able to step, whichever....
Insert the expanded macro into your code.
Can read about with the macros expanded.
You can debug macros with VS macros IDE.
Macros are not that bad if used wisely.
|
|
In C, what is the proper way to define a printf like macro that will print only when DEBUG symbol is defined?
#ifdef DEBUG #define DEBUG_PRINT(???) ??? #else #define DEBUG_PRINT(???) ??? #endif
where ??? is where I am not sure what to fill in
Started by John on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Something like:
#ifdef DEBUG #define DEBUG_PRINT(fmt, args...) fprintf(stderr, fmt, ## args) #else #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */ #endif
#ifdef DEBUG #define DEBUG_PRINT(....
|
|
In general, I occasionally have a chain of nested macros with a few preprocessor conditional elements in their definitions. These can be painful to debug since it's hard to directly see the actual code being executed.
A while ago I vaguely remember finding...
Started by Tyler on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
This might not be applicable in your situation, but macros really do hamper debugging and often all together?
You should probably....
Debug the dissasembly with the symbols loaded.
Gcc -E will output the preprocessed source to stdout.
|
Ask your Facebook Friends
|
Hi,
I am using the following macro for printing debug information that I found on the web. It works great. However, I would like to turn-off debug printing for function A when debugging function B, which calls function A. I tried #define NDEBUG function...
Answer Snippets (Read the full thread at stackoverflow):
#undef MY_DEBUG result = B(); #define MY_DEBUG....
You can do something like this though:
#if defined(NDEBUG) || !defined(MY_DEBUG(WHERESTR _fmt, WHEREARG, __VA_ARGS__) #endif /* NDEBUG */
Then, in function A():
...
Will not do anything.
|
|
What is the standard macro used to write text to the output window in Win32 (outside MFC)? I am looking for something which the pre-processor conditionally excludes from the release build.
(This might sound like SO sacrilege but I've merely forgotten ...
Started by Agnel Kurian on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Maybe you're thinking of ATLTRACE? Not quite "the standard macro", but pretty close for this, which is a debug....
There is a trace macro macros a try.
It'll send output to the debug channel.
OutputDebugString(char*).
|
|
A CrEaTiVe aRtZ Guide
Mangos and Macros M&M's
Here's a guide for a command that you've almost certainly passed by while relaxing on your server. The debug command. Perhaps you've heard of it. Chances are you've seen this command many times but simply ...
Started by 09SMalone on
, 4 posts
by 2 people.
Answer Snippets (Read the full thread at ownedcore):
Pretty useful, + rep.
Screwed up the mount number to use for the debug command, it's now fixed.
|
|
I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using eval(), but as he said, would be quite costly.
They don't really...
Started by Anders Rune Jensen on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
That'll give you macros....
Most of the JavaScript: var a, b, c, d; d = c = b = a;
Several methods in jQuery are all essentially macros, although you .
Is to use functions, shorthand and ternary conditions as a replacement for macros.
|
|
I've been working with a large codebase written primarily by programmers who no longer work at the company. One of the programmers apparently had a special place in his heart for very long macros. The only benefit I can see to using macros is being able...
Started by jdizzle on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
If the macros exists of copying code....
Inline functions serve every useful purpose a macro, and replacing the macro output with function calls (inline if possible) or straight LOC.
I don't use macros at all.
What you describe.
|
|
What is the worst real-world macros/pre-processor abuse you've ever come across (please no contrived IOCCC answers *haha*)?
Please add a short snippet or story if it is really entertaining. The goal is to teach something instead of always telling people...
Started by Trevor Boyd Smith on
, 59 posts
by 54 people.
Answer Snippets (Read the full thread at stackoverflow):
MrValdez is annoyed by the GetObject macro found(-1); \ } \
I was pretty new to the practice of using macros and used this macro, but I expected to load the correct Roster....
Windows.h has a lot of functions that abused macros.
|
|
In my experience, not all macros have been evil. Along the course of my career, macros have been useful in a limited context. In MFC, message crackers provided a concise DSL-like description for message maps. Type-agnostic macros provided useful utility...
Started by Kevin on
, 19 posts
by 19 people.
Answer Snippets (Read the full thread at stackoverflow):
Macros in C++ are not always evil answer, for example, is probably....
Sure, if a macro language is designed right then it makes it easier, but I have yet to use", for any value of "thing" that can be written as a macro.
To debug.
|