I have compiled this sniplet:
main (int argc, char *argv[])
{
int i;
const mares_iconhd_model_t models[] = {
{"Matrix", MATRIX},
// {"Smart Apnea", SMARTAPNEA},
{"Smart", SMART},
{"Icon HD", ICONHD},
{"Icon AIR", ICONHDNET},
{"Puck Pro", PUCKPRO},
{"Nemo Wide 2", NEMOWIDE2},
{"Puck 2", PUCK2},
};
// Check the product name in the version packet against the list
// with valid names, and return the corresponding model number.
unsigned int model = 0;
for ( i = 0; i < 7; ++i) {
printf ("i: %d, sizeof: %d, strlen: %d\n",i,sizeof(models[i].name),strlen (models[i].name));
}
}
and the corresponding ouput is:
giorgio@giorgio-laptop:~$ ./prova
i: 0, sizeof: 17, strlen: 6
i: 1, sizeof: 17, strlen: 5
i: 2, sizeof: 17, strlen: 7
i: 3, sizeof: 17, strlen: 8
i: 4, sizeof: 17, strlen: 8
i: 5, sizeof: 17, strlen: 11
i: 6, sizeof: 17, strlen: 6
So it seems to me that either we use strlen or we use strcmp
G