Click here to Skip to main content
15,886,554 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: safely returning classes from functions... when and when not to construct ! Pin
paolosh24-Jul-09 23:48
paolosh24-Jul-09 23:48 
QuestionBeginner: How to access elements in a Variant array of Variants (8204) Pin
BeerFizz24-Jul-09 4:19
BeerFizz24-Jul-09 4:19 
QuestionReturning large objects from a function without unnecessarily invoking the constructor ! Pin
paolosh24-Jul-09 3:31
paolosh24-Jul-09 3:31 
AnswerRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
transoft24-Jul-09 3:43
transoft24-Jul-09 3:43 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
paolosh24-Jul-09 3:51
paolosh24-Jul-09 3:51 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
peterchen24-Jul-09 3:58
peterchen24-Jul-09 3:58 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
paolosh24-Jul-09 4:09
paolosh24-Jul-09 4:09 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
peterchen24-Jul-09 8:37
peterchen24-Jul-09 8:37 
Yes, exactly.

With a "double", there is no constructor or destructor, so there is not much to see.

But you can try these things with a class like this you can play around and see the effects:

class MyTest
{
public:

   MyTest() { cout << "Creating MyTest " << this << endl; }
   MyTest(MyTest const & rhs) { cout << "Copy-Construct MyTest " << this << " from " << &rhs << endl; }
   MyTest& operator=(MyTest const & rhs) { cout << "Assign MyTest " << this << " from " << &rhs << endl; }
   ~MyTest() { cout << "Destroying " << this; }
}


Be aware that the effects are not exactly the same on every compiler, since the standard allows some optimizations.

Don't attribute to stupidity what can be equally well explained by buerocracy.
My latest article | Linkify!| FoldWithUs! | sighist


GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
transoft24-Jul-09 5:04
transoft24-Jul-09 5:04 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
peterchen24-Jul-09 5:09
peterchen24-Jul-09 5:09 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
transoft24-Jul-09 5:27
transoft24-Jul-09 5:27 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
peterchen24-Jul-09 8:31
peterchen24-Jul-09 8:31 
AnswerRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
«_Superman_»24-Jul-09 3:54
professional«_Superman_»24-Jul-09 3:54 
AnswerRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
paolosh24-Jul-09 4:22
paolosh24-Jul-09 4:22 
GeneralRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
Emilio Garavaglia24-Jul-09 7:50
Emilio Garavaglia24-Jul-09 7:50 
AnswerRe: Returning large objects from a function without unnecessarily invoking the constructor ! Pin
Nemanja Trifunovic24-Jul-09 8:58
Nemanja Trifunovic24-Jul-09 8:58 
Questionflickering issues with GDI+ Pin
Adassus24-Jul-09 3:26
Adassus24-Jul-09 3:26 
AnswerRe: flickering issues with GDI+ Pin
Iain Clarke, Warrior Programmer24-Jul-09 3:35
Iain Clarke, Warrior Programmer24-Jul-09 3:35 
AnswerRe: flickering issues with GDI+ Pin
Randor 24-Jul-09 9:12
professional Randor 24-Jul-09 9:12 
QuestionRemote Desktop Access by using client/server architecture Pin
Madhu_Rani24-Jul-09 3:20
Madhu_Rani24-Jul-09 3:20 
QuestionRe: Remote Desktop Access by using client/server architecture Pin
Moak25-Jul-09 0:04
Moak25-Jul-09 0:04 
AnswerRe: Remote Desktop Access by using client/server architecture Pin
Bacon Ultimate Cheeseburger25-Jul-09 16:20
Bacon Ultimate Cheeseburger25-Jul-09 16:20 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Madhu_Rani26-Jul-09 20:10
Madhu_Rani26-Jul-09 20:10 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Bacon Ultimate Cheeseburger29-Jul-09 18:35
Bacon Ultimate Cheeseburger29-Jul-09 18:35 
GeneralRe: Remote Desktop Access by using client/server architecture Pin
Madhu_Rani29-Jul-09 19:46
Madhu_Rani29-Jul-09 19:46 

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.