lundi 1 août 2016

Replacing #define

I want to replace a

#define INTERVAL_MASK(b) (1 << (b))

with a inline function.

int INTERVAL_MASK(int b)
{
    return (1 << b);
}

But I have a switch case, which uses the preprocessor directive in the case statements. How to go about converting this? Replacing the switch with if is the only option?

Aucun commentaire:

Enregistrer un commentaire