473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MARCO

Hi,
I read a Marco definition in a source file, which is shown below.
#define BEGIN_EVENT_TABLE(theClass, baseClass) \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] };

Because I am not a C++ expert, I don't understand the meaning of the
definition. Why does two variables, baseClass::sm_eventTable and
theClass::sm_eventTableEntries[0], appear in the braces at the same time.
Which value is assigned to theClass::sm_eventTable. Is there anyone could
explain for me? Thank you!

Dennis
Jul 22 '05 #1
3 2372
Wei-Chao Hsu wrote in news:bs********@netnews.hinet.net:

I read a Marco definition in a source file, which is shown below.
s/Marco/Macro/g


#define BEGIN_EVENT_TABLE(theClass, baseClass) \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable,
&theClass::sm_eventTableEntries[0] };

Because I am not a C++ expert, I don't understand the meaning of the
definition. Why does two variables, baseClass::sm_eventTable and
theClass::sm_eventTableEntries[0], appear in the braces at the same
time. Which value is assigned to theClass::sm_eventTable. Is there
anyone could explain for me? Thank you!


theClass::sm_eventTable is an agragate and bothe values in the braces
get assigned to it.

A simple example:

#include <iostream>

struct XY
{
int x;
int y;
};

XY xy = { 1, 2 };

int main()
{
std::cerr << xy.x << '\n';
std::cerr << xy.y << '\n';
}

The output is:
1
2

HTH.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 22 '05 #2

Wei-Chao Hsu wrote:
#define BEGIN_EVENT_TABLE(theClass, baseClass) \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; Because I am not a C++ expert, I don't understand the meaning of the
definition. Why does two variables, baseClass::sm_eventTable and
theClass::sm_eventTableEntries[0], appear in the braces at the same
time. Which value is assigned to theClass::sm_eventTable. Is there
anyone could explain for me? Thank you!

POLO!

If Rob's excellent example didn't clear help, try this:

http://www.devx.com/getHelpOn/Article/16039/0/page/3
-Jeff

Jul 22 '05 #3
Thanks for your help. I have understood.
Wei-Chao Hsu wrote:
> #define BEGIN_EVENT_TABLE(theClass, baseClass) \
> const wxEventTable theClass::sm_eventTable = \
> { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] };

> Because I am not a C++ expert, I don't understand the meaning of the
> definition. Why does two variables, baseClass::sm_eventTable and
> theClass::sm_eventTableEntries[0], appear in the braces at the same
> time. Which value is assigned to theClass::sm_eventTable. Is there
> anyone could explain for me? Thank you!

POLO!

If Rob's excellent example didn't clear help, try this:

http://www.devx.com/getHelpOn/Article/16039/0/page/3
-Jeff

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Charles Griswold | last post by:
I'm considering using Jython as an embedded macro language within a large java app. Has anyone had experience in such an endevor?
5
by: liwei | last post by:
how can i let the follow marco works in VC6.0 #define TRACE_BEGIN(function) #ifdef DEBUG \ printf("----------------Enterinto%s-----------------\n",function);\ time_t beginTime,endTime;\...
0
by: VB Joshua | last post by:
How would one go about making a macro recorder for another program like autocad. Like the one excel has?
0
by: gabe | last post by:
i commonly switch between code view and design view using F7 and Shift F7. I would like for the properties and toolbox to show and stick in desin view but to hide when i am in code view. this...
0
by: Marco | last post by:
Hello, I have to use the propertyReader of DSOFile.dll for reading/writing custom document properties in a closed document. In the msdn http://support.microsoft.com/?scid=kb;en-us;Q224351...
1
by: Ray | last post by:
Dear all, After the deployment of my vb.net program, I install it in my client's PC. After the deployment, the marco of Excel seems doesn't work. The combo box and the button in the excel cannot...
0
by: Agnes | last post by:
After I instal .net framework, my excel run properly, However, after my vb.net application deploy in one PC. the excel marco didn't run . there is combo box, button in that excel. ALL didn't work...
1
by: silverburgh.meryl | last post by:
Is there a pre-processor marco to get the class name? (Not file name) Thank you.
7
by: Plissken.s | last post by:
Hi, If I define a template wich uses the __FILE__ marco in a .h file and I have class which creates/uses that template (in a .cpp file). What will the __FILE__ marco expand to? the .h which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.