Can you please explain that?
I find an example in addition to the comments Laserlight made will be useful.
He is essentially doing something like this:
Code:
class program
{
void start
(
int argc
, char ** argv
)
{
// program logic
}
void * data;
};
void main
(
int argc
, char ** argv
)
{
try
{
program a;
a.start(argc, argv);
}
catch(...)
{
// cleanup logic
}
}
which basically looks like this:
Code:
struct program
{
void * data;
};
void start
(
struct program * this
, int argc
, char ** argv
)
{
// program logic
}
void main
(
int argc
, char ** argv
)
{
try
{
program a;
start(&a, argc, argv);
}
catch(...)
{
// cleanup logic
}
}
in order to avoid doing this:
Code:
void * data;
void start
(
int argc
, char ** argv
)
{
// program logic
}
void main
(
int argc
, char ** argv
)
{
if(start(argc, argv))
{
// cleanup logic
}
}
because he thinks it magics away design and globally visible state problems.
Soma