»
(08) C++14 Functions and L,R Value
(18) C++14 smart pointer and reference counter*
(19) C++14 pthread*
(20) C++14 synchronized locker--mutex*
(24) C++ time and sleep*
(25) C++ High Precision Computation*
(27) C++14 std::string*
(31) Advanced Level C++ Tech*
I write this website for myself and perhaps for my children. And the main purepose is for you who want to hire me to finish a task or hire me for a job in the very very future.
I'm not interesting in others' opinions, I write what I know and what I learned to let you know what I can do.
This article shows the usage of a function in C99 and C++14.
The example of a function like this:
int main(int agrc, char* argv[]){
return 0;
}
In any function, there can be no return statement, even if the return value type is not void.
The function will return a random default value with the return value type while there is no return statement.
By the way, I want to show you the difference between L-Value and R-Value in my practice:
L-Value: there must be a value label which pointing to the memory space of the value.
R-Value: there must not be a label which pointing to the memory space of the value.
L-Value will call disconstructor function while the value label is being removed from memory.
R-Value will be destroyed automatically if no label point to the returned data after a function returned.
R-Value will not be destroyed while some new label point to the returned data after a function returned.
R-Value will be destroyed automatically after some old label received the members' data from the R-Value if some old label assigned by R-Value.