Using macro as an abstraction layer

Posted by tehnyit on Programmers See other posts from Programmers or by tehnyit
Published on 2012-03-29T09:53:52Z Indexed on 2012/03/29 11:41 UTC
Read the original article Hit count: 215

Filed under:
|

I am having a discussion with a colleague about using macro as a thin (extremely) layer of abstraction vs using a function wrapper. The example that I used is

Macro way.

#define StartOSTimer(period)  (microTimerStart(period))

Function wrapper method

void StartOSTimer(period)
{
    microTimerStart(period);
}

Personally, I liked the second method as it allows for future modification, the #include dependencies are also abstracted as well.

© Programmers or respective owner

Related posts about abstraction

Related posts about macros