In Crafty:
int OptionMatch(char *command, char *input){
/* ************************************************************ * * * check for the obvious exact match first. * * * ************************************************************ */
if (!strcmp(command, input))
return (1);
/* ************************************************************ * *
* now use strstr() to see if "input" is in "command." *
* the first requirement is that input matches command *
* starting at the very left-most character; * * * ************************************************************ */
if (strstr(command, input) == command)
return (1);
return (0);
}
It seems better to use "if " than "if-else" if it returns in the statement...
星期二, 十二月 20, 2005
星期四, 十二月 01, 2005
Learning about static construct function
http://blog.joycode.com/ghj/archive/2004/08/24/31504.aspx Using the static construct function, we can realize that the many subclass only realize the base class's construct function once. Many class need to call a function Send of a Controller class, therefore the Controller is used as base class. But the pipeline is unique, therefore it can only be initialized once, to build a pipeline. Therefore, the pipeline is initialized in construct function, and because the subclass will also call the construct function of the base class, I use the static construct function. Reading the blog articles, I found it fit for this status.
SnowyNight in Shenyang, China

---------------
Today has been December.
The Chopin has been sang in November;
it is not known where December is Debussy or Liszt.
Fir, ingle and party in the west;
but also nice reading forbidden books in ancient world.
Wish you a happy December.
----------------
Winter is always romantic, like the snowy night...
订阅:
博文 (Atom)