yair24
2005-02-09 16:27:03 UTC
hello,
I have a little problem:
I have this code:
==============================
void operate statemachine()
{
switch(state)
{
case STBY:
OperateStbyState();
break;
case READY:
OperateReadyState();
break;
.
.
.
case FIRE:
OperateFireState();
break;
}
}
void OperateStbyState()
{
/// implementation of state operations
.
.
.
}
void OperateReadyState()
{
/// implementation of state operations
.
.
.
}
void OperateFireState()
{
/// implementation of state operations
.
.
.
}
==============================
the states (STBY READY FIRE)are #defined in the begining of the file.
now, sometimes I want to add more states ao I go to the begining of
the file and define a new state for example:
#define START 10
and then I add the function
void OperateStartState();
and the implementation of this function:
void OperateStartState()
{
/// implementation of state operations
.
.
.
}
but I always forget to add this lines:
case START:
OperateStartState();
break;
and when I start to debug the program I see that when I goto START
state nothing happends...
my question is this:
is there anyway to make the compiler give me a warning in case I add
more defines but forget to add the lines in the switch statement?
(I mean something like the RS232.lib that if you dont define the
buffer size it gives you a compiler warant and defaults the buffer to
31. )
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/rabbit-semi/
<*> To unsubscribe from this group, send an email to:
rabbit-semi-unsubscribe-***@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
I have a little problem:
I have this code:
==============================
void operate statemachine()
{
switch(state)
{
case STBY:
OperateStbyState();
break;
case READY:
OperateReadyState();
break;
.
.
.
case FIRE:
OperateFireState();
break;
}
}
void OperateStbyState()
{
/// implementation of state operations
.
.
.
}
void OperateReadyState()
{
/// implementation of state operations
.
.
.
}
void OperateFireState()
{
/// implementation of state operations
.
.
.
}
==============================
the states (STBY READY FIRE)are #defined in the begining of the file.
now, sometimes I want to add more states ao I go to the begining of
the file and define a new state for example:
#define START 10
and then I add the function
void OperateStartState();
and the implementation of this function:
void OperateStartState()
{
/// implementation of state operations
.
.
.
}
but I always forget to add this lines:
case START:
OperateStartState();
break;
and when I start to debug the program I see that when I goto START
state nothing happends...
my question is this:
is there anyway to make the compiler give me a warning in case I add
more defines but forget to add the lines in the switch statement?
(I mean something like the RS232.lib that if you dont define the
buffer size it gives you a compiler warant and defaults the buffer to
31. )
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/rabbit-semi/
<*> To unsubscribe from this group, send an email to:
rabbit-semi-unsubscribe-***@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/