0

I know this is a slightly esoteric question, but I'm just curious how you guys define your function macros. Do you put a semicolon at the end or not?

For example:

#define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey);

// or

#define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey)

In the first case, the advantage is that you don't have to type a semicolon in the actual code
EVENT_RESIZE(event)
which mean it's immediately obvious that it's a macro. I know Microsoft like to do it like this sometimes..

The second scenario requires a semicolon in the actual code
EVENT_RESIZE(event);
which means it behaves more like a standard function..

Anyway I know this is a kind of stupid question, but we have to design a bunch of SDL macros to standardise our code templates and I'm just curious which is the accepted convention.

Cheers,

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by phalaris_trip
0

Yes, leave the ; out of the macro definition.

Then things like if ( EVENT_RESIZE(event) == SUCCESS ) also work as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.