Lecture overview -- Keyboard shortcut: 'u'  Previous page: Parameter passing in C++ -- Keyboard shortcut: 'p'  Next page: Type conversion - Grand Overview -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 21 : 42
Notes about C++
Basic facilities
Value return

The semantics of value return is that of initialization

  • The C++ Programming Language: Page 148
 

  • Value return

    • A copy is returned, initializing an unnamed variable

    • The copy constructor is used - not the assignment operator

  • Return of local variables

    • OK by value

    • References or pointers to local (automatic) variables should not be returned