-
August 28th, 2013, 04:03 AM
#1
[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.
-
August 28th, 2013, 04:42 AM
#2
Re: Lines without semicolon.. What is it? Function calls?
Victor Nijegorodov
-
August 28th, 2013, 05:41 AM
#3
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?
-
August 28th, 2013, 05:49 AM
#4
Re: Lines without semicolon.. What is it? Function calls?
Victor Nijegorodov
-
August 28th, 2013, 05:50 AM
#5
Re: Lines without semicolon.. What is it? Function calls?
Thanks
-
August 28th, 2013, 07:24 AM
#6
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|