Analog Devices VISUALDSP++ 3.5 Manual page 188

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

Preprocessor Features
Multi-statement Macros
Whenever possible, use inline functions rather than multi-statement mac-
ros. If multi-statement macros are necessary, define such macros to allow
invocation like function calls. This will make your source code easier to
read and maintain.
The following two code segments define two versions of the macro
.
SKIP_SPACES
/* SKIP_SPACES, regular macro */
#define SKIP_SPACES (p, limit)
char *lim = (limit); \
while ((p) != lim)
if (*(p)++ != ' ')
} \
} \
}
/* SKIP_SPACES, enclosed macro */
#define SKIP_SPACES (p, limit)
do { \
char *lim = (limit);
while ((p) != lim)
if (*(p)++ != ' ')
}
}
} while (0)
The second definition is the same as the first, except that it is enclosed in a
do {...} while (0)
pair means that the macro can be invoked more like a function.
while (0)
With the first definition, sometimes you would have to follow the macro
with a semi-colon, and sometimes you would not. Whereas with the sec-
ond definition, the
followed by a semi-colon.
1-150
(p)--; \
break; \
(p)--;
\
break;
\
\
\
construct. Enclosing the definition within the
do {...} while (0)
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
\{
{ \
{ \
\
\
{ \
{ \
pair means that the macro is
for ADSP-219x DSPs
do {...}

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Related Products for Analog Devices VISUALDSP++ 3.5

Table of Contents