I have many conversions between numeric types in my code. Something like
int x;
unsigned int y;
// x is assigned to some value at runtime
y = x;
what is the best practice to check if the value of x fits into the y without losing data and if something is lost during conversion, throws an exception?
Aucun commentaire:
Enregistrer un commentaire