26-06-2007, 08:33 AM
ylehman Wrote:Code:status foo( )
{
status st = OK;
st = bar_aaa( ); ER_CHK(st);
st = bar_bbb( ); ER_CHK(st);
st = bar_ccc( ); ER_CHK(st);
ER_EXIT:
return st;
}
ER_CHK is a macro that is defined as follows: (simplified)
Code:#define ER_CHK(st) if (st != OK) goto ER_EXIT; else ;
[...]
Is such a use of GOTO allowed ?
This clearly isn't MISRA compliant. You can't goto. (You also need braces on your if-controlled statements, and brackets around "(st)".)
But if you want to do this then just raise a deviation. It shouldn't be hard to justify.
stephen