T
talkaboutquality
Need to define a macro as, say,
#ifdef NEED_FUNCTION
foo(x)
#else
#endif
Say that macro is called FOO(x) and is used by writing
FOO(x);
with a semicolon after it so it looks like any other statement.
When NEED_FUNCTION is defined, then compiler sees
foo(x);
When NEED_FUNCTION is not defined, compiler sees
;
If I want to place
FOO(x);
in a larger function _before_ the local variable declarations, will I get
a compiler error (for doing something I shouldn't before declarations)?
If so, why?
If not, why not?
If I will get a compiler error, what can I define that macro as in the
else section so that that text, followed by the semicolon, will be an
allowed statement even before local variable declarations?
Thanks!
Tom Harris
(e-mail address removed)
http://talkaboutquality.wordpress.com
#ifdef NEED_FUNCTION
foo(x)
#else
#endif
Say that macro is called FOO(x) and is used by writing
FOO(x);
with a semicolon after it so it looks like any other statement.
When NEED_FUNCTION is defined, then compiler sees
foo(x);
When NEED_FUNCTION is not defined, compiler sees
;
If I want to place
FOO(x);
in a larger function _before_ the local variable declarations, will I get
a compiler error (for doing something I shouldn't before declarations)?
If so, why?
If not, why not?
If I will get a compiler error, what can I define that macro as in the
else section so that that text, followed by the semicolon, will be an
allowed statement even before local variable declarations?
Thanks!
Tom Harris
(e-mail address removed)
http://talkaboutquality.wordpress.com