C Preprocessor: #define in C... advice
Posted
by vikramtheone
on Stack Overflow
See other posts from Stack Overflow
or by vikramtheone
Published on 2010-05-26T14:44:11Z
Indexed on
2010/05/26
14:51 UTC
Read the original article
Hit count: 265
Hi Guys, I'm making a big C project and I have never come across a situation like this before so, I need your advice.
What is your opinion? Is it okay to have the constants defined within conditional preprocessors like I have done below or you advise me to do this some other way?
Any drawbacks if I do it this way?
Regards
Vikram
#define NUM_OCTAVES_4
//#define NUM_OCTAVES_5
#ifdef NUM_OCTAVES_4
#define OCTAVES 4
const unsigned char borders [4] = {11, 26, 50, 98};
#elif NUM_OCTAVES_5
#define OCTAVES 5
const unsigned char borders [5] = {11, 26, 50, 98, 194};
#endif
© Stack Overflow or respective owner