[RESOLVED] Lines without semicolon.. What is it? Function calls?
The below code is taken from open source filezilla project (FileZilla_3.7.3_src\filezilla-3.7.3\src\interface\bookmarks_dialog.cpp)
Code:
#include <filezilla.h>
#include "bookmarks_dialog.h"
#include "sitemanager.h"
#include "ipcmutex.h"
#include "themeprovider.h"
#include "xmlfunctions.h"
BEGIN_EVENT_TABLE(CNewBookmarkDialog, wxDialogEx)
EVT_BUTTON(XRCID("wxID_OK"), CNewBookmarkDialog::OnOK)
EVT_BUTTON(XRCID("ID_BROWSE"), CNewBookmarkDialog::OnBrowse)
END_EVENT_TABLE()
I'm unable to understand what are these lines after the #include. They don't end in semicolons. Looks very much like function calls.
Are BEGIN_EVENT_TABLE, EVT_BUTTON and END_EVENT_TABLE function calls? Function calls should end with semicolons right?
Can someone help me with this.. thanks.
Re: Lines without semicolon.. What is it? Function calls?
Re: Lines without semicolon.. What is it? Function calls?
Thanks VictorN. So these must be macro function calls and they must be defined somewhere else using #define. Am I correct?
Re: Lines without semicolon.. What is it? Function calls?
Re: Lines without semicolon.. What is it? Function calls?
Re: [RESOLVED] Lines without semicolon.. What is it? Function calls?
to be more precise, macro's aren't "function calls" as you say it.
a better analogy is that they are "substituted" in-place by by the compiler in a separate step before the actual compilation.
the above isn't entirely right as it wouldn't really explain what's actually going on, but as a simple "this is how it usually works" analogy it's adequate to get a grasp on it.
If you look up the END_EVENT_TABLE() macro, you could copy the macro "value" and then paste this in place of the END_EVENT_TABLE() in the code, and then compile to get the same result.
You could do the same with the other macro's although it'll be a bit more work as you'd also have to properly substitute the macro parameters.
macro's have their uses, but as a general rule. Try to make your own code without defining your own. macro's have a few nasty sideeffects that can cause serious headaches :p