Let's say (in C) we define a set of error codes,
#define action_success 0x00
#define action_fail -0x01
#define action_status_unknown 0x02
and a function
int PerformSomeAction(int *someInput){
if(!someInput) return action_status_unknown;
if(sizeof(someInput)/sizeof(int) < 20) return action_fail;
if(sizeof(someInput)/sizeof(int) >= 21) return action_success;
}
In cases similar to these, is it good to follow such a strategy?
Aucun commentaire:
Enregistrer un commentaire