T
Tony
I'm working with GUI messaging and note that MFC encapsulates
the message loop inside of a C++ class member function. Is this
somehow inherently less robust than calling the message loop
functions within main? (It just doesn't "feel" right to me).
Example 1:
class MyProg
{
public:
void Run()
{
Msg m;
while(GetMsg(m))
DispatchMsg(m);
}
};
int main()
{
MyProg p;
p.Run(); // just doesn't feel right to run the whole prog in a class
func
return 1;
}
Example 2:
int main()
{
Msg m;
while(GetMsg(m))
DispatchMsg(m);
return 1;
}
What I'm thinking about is whether a class is more likely to be corrupted
than the equivalent C code. Perhaps if C++ went "all the way" and eliminated
the C main function I'd feel better with the class-encapsulated message
loop.
As it is though, even C++ likes procedural main rather than some kind of
"program" class.
Please feel free to add any comments on tangential but associated topics
also.
Tony
the message loop inside of a C++ class member function. Is this
somehow inherently less robust than calling the message loop
functions within main? (It just doesn't "feel" right to me).
Example 1:
class MyProg
{
public:
void Run()
{
Msg m;
while(GetMsg(m))
DispatchMsg(m);
}
};
int main()
{
MyProg p;
p.Run(); // just doesn't feel right to run the whole prog in a class
func
return 1;
}
Example 2:
int main()
{
Msg m;
while(GetMsg(m))
DispatchMsg(m);
return 1;
}
What I'm thinking about is whether a class is more likely to be corrupted
than the equivalent C code. Perhaps if C++ went "all the way" and eliminated
the C main function I'd feel better with the class-encapsulated message
loop.
As it is though, even C++ likes procedural main rather than some kind of
"program" class.
Please feel free to add any comments on tangential but associated topics
also.
Tony