In 'comp.lang.c',
qa********@rediffmail.com (qazmlp) wrote:
There are some blocks of C/C++ code put under
#if 0
#end if
Is there anyway to make the code inside these blocks to get executed
(may be by using some command line options)?
The question is not to be /executed/ of not, but to be *compiled* or not.
The #if 0 trick is used to uncomment easily one or several lines of code.
You could also use a more clever trick that is
#ifndef DBG
#define DBG 0 /* 0 | 1 */
#endif
<...>
#if DBG
/* code to be commented out (or not) */
#endif
Now, some compilers allows you to define a macro on the command line.
Say ...
-DDBG=1
or
-DDBG=0
.... according to your needs.
I often use this trick on embedded systems to reduce the size of some library
code when parts of it are not used.
--
-ed-
em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ:
http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c :
http://www.isty-info.uvsq.fr/~rumeau/fclc/