Click here to Skip to main content
15,878,871 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Embedded C program Pin
Victor Nijegorodov23-Sep-20 8:42
Victor Nijegorodov23-Sep-20 8:42 
AnswerRe: Embedded C program Pin
Dave Kreskowiak23-Sep-20 9:20
mveDave Kreskowiak23-Sep-20 9:20 
QuestionWhy isn't the copy constructor called Pin
Mircea Neacsu22-Sep-20 14:59
Mircea Neacsu22-Sep-20 14:59 
AnswerRe: Why isn't the copy constructor called Pin
_Flaviu22-Sep-20 19:48
_Flaviu22-Sep-20 19:48 
GeneralRe: Why isn't the copy constructor called Pin
Mircea Neacsu23-Sep-20 1:45
Mircea Neacsu23-Sep-20 1:45 
AnswerRe: Why isn't the copy constructor called Pin
Richard MacCutchan22-Sep-20 23:38
mveRichard MacCutchan22-Sep-20 23:38 
GeneralRe: Why isn't the copy constructor called Pin
Mircea Neacsu23-Sep-20 1:56
Mircea Neacsu23-Sep-20 1:56 
AnswerRe: Why isn't the copy constructor called - Solved Pin
Mircea Neacsu23-Sep-20 2:56
Mircea Neacsu23-Sep-20 2:56 
A more thorough use of Google brought me the this:

Quote:
Whenever a temporary object is created for the sole purpose of being copied and subsequently destroyed, the compiler is allowed to remove the temporary object entirely and construct the result directly in the recipient (i.e. directly in the object that is supposed to receive the copy).

This process is called elision of copy operation. It is described in [class.copy.elison] in the language standard.

In this case

B* bptr = new B(B(aobj));
can be transformed into

B* bptr = new B(aboj);

even if the copy constructor has side-effects.
Mircea

GeneralRe: Why isn't the copy constructor called - Solved Pin
Richard MacCutchan23-Sep-20 3:01
mveRichard MacCutchan23-Sep-20 3:01 
GeneralRe: Why isn't the copy constructor called - Solved Pin
Greg Utas24-Sep-20 1:00
professionalGreg Utas24-Sep-20 1:00 
GeneralRe: Why isn't the copy constructor called - Solved Pin
Mircea Neacsu24-Sep-20 2:51
Mircea Neacsu24-Sep-20 2:51 
GeneralRe: Why isn't the copy constructor called - Solved Pin
Greg Utas24-Sep-20 3:20
professionalGreg Utas24-Sep-20 3:20 
Questioncompilers for pure assembly code Pin
Calin Negru19-Sep-20 0:46
Calin Negru19-Sep-20 0:46 
AnswerRe: compilers for pure assembly code Pin
Richard MacCutchan19-Sep-20 2:24
mveRichard MacCutchan19-Sep-20 2:24 
AnswerRe: compilers for pure assembly code Pin
Joe Woodbury22-Sep-20 11:38
professionalJoe Woodbury22-Sep-20 11:38 
AnswerRe: compilers for pure assembly code Pin
Calin Negru24-Sep-20 1:00
Calin Negru24-Sep-20 1:00 
QuestionWhy do I get "undefined reference to..." when trying to call a C-function inside a .cpp-file? Pin
arnold_w10-Sep-20 4:54
arnold_w10-Sep-20 4:54 
AnswerRe: Why do I get "undefined reference to..." when trying to call a C-function inside a .cpp-file? PinPopular
Richard MacCutchan10-Sep-20 5:30
mveRichard MacCutchan10-Sep-20 5:30 
QuestionIcons for Executable Files - SOLVED Pin
Richard Andrew x649-Sep-20 14:55
professionalRichard Andrew x649-Sep-20 14:55 
QuestionWhat's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 8:16
arnold_w9-Sep-20 8:16 
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Mircea Neacsu9-Sep-20 11:20
Mircea Neacsu9-Sep-20 11:20 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 11:33
arnold_w9-Sep-20 11:33 
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Mircea Neacsu9-Sep-20 12:11
Mircea Neacsu9-Sep-20 12:11 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 12:28
arnold_w9-Sep-20 12:28 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Randor 9-Sep-20 12:44
professional Randor 9-Sep-20 12:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.