undefine all macros from a file

R

Rafal 'Raf256' Maj

Hi,
is there a commend to undefine all macros #define inside a file?

in example:

#define FOR(x) for (..............)
#define MyMacro1(x,y) ...........

// ... code ...

#undef all-macros

So that, if file above would be a *.h file included somewhere else, it will
not left "garbage" of own "local" macros.

Yes, I know its better to use templates etc, but in some cases I find
macros a bit more comfortable.
 
J

Jonathan Turkanis

Rafal said:
Hi,
is there a commend to undefine all macros #define inside a file?

in example:

#define FOR(x) for (..............)
#define MyMacro1(x,y) ...........

// ... code ...

#undef all-macros

So that, if file above would be a *.h file included somewhere else,
it will not left "garbage" of own "local" macros.

Sorry, you have to undef them all individually.
Yes, I know its better to use templates etc, but in some cases I find
macros a bit more comfortable.

I like macros too. If you follow good naming conventions, you shouldn't find
yourself having to undef a lot of macros.

Of course, often the poorly named macros come from headers outside of your
control, which is infuriating. undef'ing all the macros is generally not the
right solution, though.

Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top