I read a c++ tutorial that says arithmetic operators return the smallest data type possible (i.e. if 2 ints are added the return type will be int, if a float and a double are added the return type will be double). However, it also said that arithmetic operations on shorts return ints. Considering that shorts take up less memory than ints, why does that happen? Was the tutorial mistaken? The tutorial was for c++11, so maybe that has been deprecated in c++14? Thanks!
Aucun commentaire:
Enregistrer un commentaire