Click here to Skip to main content
16,004,887 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: RegSetValueEx Pin
David Crow22-Aug-07 2:47
David Crow22-Aug-07 2:47 
AnswerRe: RegSetValueEx Pin
George_George22-Aug-07 3:13
George_George22-Aug-07 3:13 
QuestionFairly basic pointer/array question Pin
MALDATA21-Aug-07 16:32
MALDATA21-Aug-07 16:32 
AnswerRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 16:54
cp987621-Aug-07 16:54 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA21-Aug-07 18:17
MALDATA21-Aug-07 18:17 
GeneralRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 19:13
cp987621-Aug-07 19:13 
GeneralRe: Fairly basic pointer/array question Pin
Nelek21-Aug-07 20:14
protectorNelek21-Aug-07 20:14 
GeneralRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 21:12
cp987621-Aug-07 21:12 
Nelek wrote:
If you are using Doc/View architecture (If not you can "simulate" it using a "DataStore" class/module), You may code more or less the same as you have, but returning a reference to an object that will not be destroyed when you return.


Returning a reference to a local object is just as bad as returning a pointer (same thing in fact, different syntax). The only safe way to return a local object is to return a copy of it, e.g.

int function()
   {
   int n;
   // do something
   return n;
   }


You can do the same thing with objects, but you will invoke the object's copy constructor.



Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 1:20
protectorNelek22-Aug-07 1:20 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA22-Aug-07 4:18
MALDATA22-Aug-07 4:18 
GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 4:55
protectorNelek22-Aug-07 4:55 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA22-Aug-07 8:39
MALDATA22-Aug-07 8:39 
GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 20:01
protectorNelek22-Aug-07 20:01 
GeneralRe: Fairly basic pointer/array question Pin
cp987622-Aug-07 20:40
cp987622-Aug-07 20:40 
QuestionCreateDirectoryA can not be resolved Pin
George_George21-Aug-07 16:27
George_George21-Aug-07 16:27 
AnswerRe: CreateDirectoryA can not be resolved [modified] Pin
Paresh Chitte21-Aug-07 18:36
Paresh Chitte21-Aug-07 18:36 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George21-Aug-07 20:51
George_George21-Aug-07 20:51 
GeneralRe: CreateDirectoryA can not be resolved Pin
Paresh Chitte21-Aug-07 22:05
Paresh Chitte21-Aug-07 22:05 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George21-Aug-07 22:23
George_George21-Aug-07 22:23 
AnswerRe: CreateDirectoryA can not be resolved Pin
David Crow22-Aug-07 2:30
David Crow22-Aug-07 2:30 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George22-Aug-07 3:16
George_George22-Aug-07 3:16 
QuestionEncoder Pin
celllllllll21-Aug-07 12:08
celllllllll21-Aug-07 12:08 
QuestionRe: Encoder Pin
celllllllll21-Aug-07 12:27
celllllllll21-Aug-07 12:27 
AnswerRe: Encoder Pin
cp987621-Aug-07 13:29
cp987621-Aug-07 13:29 
AnswerRe: Encoder Pin
El Corazon21-Aug-07 13:48
El Corazon21-Aug-07 13:48 

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.