Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I pass String class to a function Pin
CPallini25-Apr-08 22:56
mveCPallini25-Apr-08 22:56 
GeneralRe: How do I pass String class to a function Pin
Cedric Moonen25-Apr-08 23:37
Cedric Moonen25-Apr-08 23:37 
Replace the first option by:

void new_function(const string& s)
{
// whatever
}


This achieve the same result but is more efficient: you don't duplicate the object you pass to the function. The end result is the same (and even safer) because if you were trying to modify the string (in your option), this would have no impact over the original object. With passing the object as a const reference, you ensure that what is in the fact won't try to change the object.

Cédric Moonen
Software developer

Charting control [v1.4 - Updated]

AnswerRe: How do I pass String class to a function Pin
zengkun10026-Apr-08 2:56
zengkun10026-Apr-08 2:56 
QuestionDLL in Visual C++6 Pin
Member 430138525-Apr-08 19:31
Member 430138525-Apr-08 19:31 
GeneralRe: DLL in Visual C++6 Pin
Saurabh.Garg25-Apr-08 20:31
Saurabh.Garg25-Apr-08 20:31 
GeneralRe: DLL in Visual C++6 Pin
Hamid_RT25-Apr-08 20:40
Hamid_RT25-Apr-08 20:40 
GeneralCOM unable to obtain interface - Pin
act_x25-Apr-08 13:12
act_x25-Apr-08 13:12 
GeneralRe: COM unable to obtain interface - Pin
Tarmo Kalda25-Apr-08 20:50
Tarmo Kalda25-Apr-08 20:50 
QuestionRe: COM unable to obtain interface - Pin
CPallini25-Apr-08 22:50
mveCPallini25-Apr-08 22:50 
GeneralRe: COM unable to obtain interface - Pin
act_x28-Apr-08 7:40
act_x28-Apr-08 7:40 
GeneralRe: COM unable to obtain interface - Pin
CPallini28-Apr-08 9:58
mveCPallini28-Apr-08 9:58 
QuestionAddSearchProvider for all browsers Pin
vikrant kpr25-Apr-08 10:50
vikrant kpr25-Apr-08 10:50 
GeneralINTRODUCTION Pin
tuneroz25-Apr-08 8:46
tuneroz25-Apr-08 8:46 
GeneralRe: INTRODUCTION Pin
Joan M25-Apr-08 8:51
professionalJoan M25-Apr-08 8:51 
GeneralRe: INTRODUCTION Pin
Hamid_RT25-Apr-08 9:15
Hamid_RT25-Apr-08 9:15 
GeneralRe: INTRODUCTION Pin
tuneroz25-Apr-08 9:26
tuneroz25-Apr-08 9:26 
GeneralRe: INTRODUCTION Pin
Hamid_RT25-Apr-08 20:41
Hamid_RT25-Apr-08 20:41 
GeneralRe: INTRODUCTION Pin
CPallini25-Apr-08 9:56
mveCPallini25-Apr-08 9:56 
GeneralRe: INTRODUCTION Pin
Hamid_RT25-Apr-08 20:38
Hamid_RT25-Apr-08 20:38 
GeneralRe: INTRODUCTION Pin
CPallini25-Apr-08 22:47
mveCPallini25-Apr-08 22:47 
GeneralRe: INTRODUCTION Pin
Hamid_RT26-Apr-08 4:18
Hamid_RT26-Apr-08 4:18 
QuestionRequired C++ source code for below question Pin
ChayaMandini25-Apr-08 6:49
ChayaMandini25-Apr-08 6:49 
GeneralRe: Required C++ source code for below question Pin
CPallini25-Apr-08 6:58
mveCPallini25-Apr-08 6:58 
GeneralRe: Required C++ source code for below question Pin
Maximilien25-Apr-08 7:08
Maximilien25-Apr-08 7:08 
GeneralRe: Required C++ source code for below question Pin
Hamid_RT25-Apr-08 7:11
Hamid_RT25-Apr-08 7:11 

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.