unsigned long get_long(); //returns some crazy large unsigned long
int i;
i = get_long() % 20;
The value of the right hand side should ALWAYS be big enough to fit into an integer because the possible values are only {0, 1, 2 .... 18, 19}.
Can I assume that the compiler can convert that unsigned long
right hand side to an integer on the left hand side?
Aucun commentaire:
Enregistrer un commentaire