Also, macros are just "compile time helpers", think of them as "mildly smart typists" Whatever you put in after the macro name is considered text. In your example, you immedately start with a curley brace as if you think that's part of the define syntax. It is not, the curley brace will be included in every expansion of the macro.
As Paul said, there is a continuation character (\) to make macros expand to multiple lines. The only thing that terminates a macro definition is a line without a continuation, there is no "end curley brace".
The Windows/MFC
BEGIN_MESSAGE_MAP
/
END_MESSAGE_MAP
macros do a similar thing, having a being and end wrapper around some other macro code. You might want to look at how those macros are written. They are in afxwin.h (pasted below) Ignoring just
how the message map works, the syntax for these wrapper macros should be helpful in writing yours.
#define BEGIN_MESSAGE_MAP(theClass, baseClass) \
PTM_WARNING_DISABLE \
const AFX_MSGMAP* theClass::GetMessageMap() const \
{ return GetThisMessageMap(); } \
const AFX_MSGMAP* PASCAL theClass::GetThisMessageMap() \
{ \
typedef theClass ThisClass; \
typedef baseClass TheBaseClass; \
static const AFX_MSGMAP_ENTRY _messageEntries[] = \
{
#define END_MESSAGE_MAP() \
{0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 } \
}; \
static const AFX_MSGMAP messageMap = \
{ &TheBaseClass::GetThisMessageMap, &_messageEntries[0] }; \
return &messageMap; \
} \