This article says:
If I write such a line inside the function:, return 1.4it is obvious to me and the compiler that the function returns double .
return 1.4
This is not obvious to me: the return type can be a float, double or long double. How does the compiler choose between 3 types?
No, 1.4- double. floatis written as1.4f
1.4
double
float
1.4f
75 // int 75u // unsigned int 75l // long 75ul // unsigned long 75lu // unsigned long 3.14159L // long double 6.02e23f // float
Source
1.4is a doubleliteral, unlike a floatliteral 1.4fand a long doubleliteral 1.4l.
long double
1.4l
, .
, auto return type, - , .
auto
: 1.4 double, float long double, double . , .
1.4 ( ) double. float, 1.4f, long double - 1.4L.
1.4L
1.4 double, double.
float 1.4f
1.4 // double 1.4f // float 1.4L // long double
Source: https://habr.com/ru/post/1622331/More articles:How can I send data via the Fetch API on a GET request? - fetchGuava Sets.difference # isEmpty() поведение - javaThe sonar quality profile on the command line cannot be replaced by the project profile - sonarqubeDrupal 8 REST Resource POST Method - restiOS Converting a phone number to an international format - phone-numberDeleting a SQLite database file using Java does not work - javaRelativeLayout position below RelativeLayout - androidCalculate size for decoded Base 64 message - c ++ошибка времени выполнения при литье (down casting) типа в другой подтип - castingC ++ 11 operator overload with subtraction of return type - c ++All Articles