Re: help me.
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Tue, 26 Sep 2006 04:25:19 GMT
Responding to Wu...
thanks for your reply.
In fact, above source code is just like goto statement, when you want
to do something, your assign the "state" variable to some value. the
"exit" flag will be set
after certain state is reached or the "quit" signal reach. this method
is really bad. Not only the code is like a mess, but sometimes the
modification of share memory will lost. I think the better solution
will be some kind of message(signal etc) instead of poll sharememory.
but now I only have rights to modify the control panel. so what I can
do is make this block of source code more readable.
I assume one of the DoSomeX operations would set the exit flag. You could deal with that without a global flag by substituting
while (TRUE)
{
if (GetAState())
if (!DoSomeA()) break;
if (GetCState())
if (!DoSomeC()) break;
...
}
in my proposal.
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info@xxxxxxxxxxxxxxxxx for your copy.
Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH
.
- References:
- help me.
- From: Leon Wu
- Re: help me.
- From: H. S. Lahman
- Re: help me.
- From: Leon Wu
- help me.
- Prev by Date: Re: Abstract public member variales?
- Next by Date: Re: Polymorphism Downsides
- Previous by thread: Re: help me.
- Next by thread: OO is not that great: many repeated codes
- Index(es):
Relevant Pages
|