Click here to Skip to main content
16,011,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++: Pin
Derek Waters7-Mar-02 11:34
Derek Waters7-Mar-02 11:34 
GeneralSTL: returning const char* from a temp string Pin
6-Mar-02 22:25
suss6-Mar-02 22:25 
GeneralRe: STL: returning const char* from a temp string Pin
Joaquín M López Muñoz6-Mar-02 22:52
Joaquín M López Muñoz6-Mar-02 22:52 
GeneralRe: STL: returning const char* from a temp string Pin
danwatt6-Mar-02 23:00
danwatt6-Mar-02 23:00 
GeneralRe: STL: returning const char* from a temp string Pin
Tim Smith7-Mar-02 2:22
Tim Smith7-Mar-02 2:22 
GeneralRe: STL: returning const char* from a temp string Pin
Tomasz Sowinski7-Mar-02 2:31
Tomasz Sowinski7-Mar-02 2:31 
GeneralRe: STL: returning const char* from a temp string Pin
Le centriste7-Mar-02 3:54
Le centriste7-Mar-02 3:54 
GeneralRe: STL: returning const char* from a temp string Pin
Tomasz Sowinski7-Mar-02 4:01
Tomasz Sowinski7-Mar-02 4:01 
Returning std::string by value will cause one or two memory allocations for the contents of buffer - two if your compiler doesn't support so-called 'return value optimization'.

Please note that this is not a problem, unless 'myfunc' is time-critical function. Don't fool yourself into thinking that you need to worry after one or two nanoseconds. Try to save cycles where it really matters.

If you absolutely need to reduce the overhead, you may consider changing the function header to accept std::string reference instead. Instead of returning string, you'll be using operator= at the end of the function.

Tomasz Sowinski -- http://www.shooltz.com
QuestionHow do I write a vertical text Pin
Abhishek Narula6-Mar-02 22:05
Abhishek Narula6-Mar-02 22:05 
AnswerRe: How do I write a vertical text Pin
Mazdak6-Mar-02 22:25
Mazdak6-Mar-02 22:25 
GeneralRe: How do I write a vertical text Pin
Abhishek Narula6-Mar-02 22:35
Abhishek Narula6-Mar-02 22:35 
GeneralRe: How do I write a vertical text Pin
Mazdak6-Mar-02 23:56
Mazdak6-Mar-02 23:56 
GeneralRe: How do I write a vertical text Pin
Abhishek Narula7-Mar-02 0:01
Abhishek Narula7-Mar-02 0:01 
GeneralRe: How do I write a vertical text Pin
Mazdak7-Mar-02 0:06
Mazdak7-Mar-02 0:06 
AnswerRe: How do I write a vertical text Pin
Joaquín M López Muñoz6-Mar-02 23:18
Joaquín M López Muñoz6-Mar-02 23:18 
AnswerRe: How do I write a vertical text Pin
Atul Dharne7-Mar-02 0:05
Atul Dharne7-Mar-02 0:05 
GeneralRe: How do I write a vertical text Pin
Abhishek Narula7-Mar-02 1:05
Abhishek Narula7-Mar-02 1:05 
GeneralDrawing a bitmap into a CEdit Pin
6-Mar-02 21:22
suss6-Mar-02 21:22 
GeneralRe: Drawing a bitmap into a CEdit Pin
Christian Graus6-Mar-02 21:28
protectorChristian Graus6-Mar-02 21:28 
GeneralRe: Drawing a bitmap into a CEdit Pin
Mazdak6-Mar-02 22:27
Mazdak6-Mar-02 22:27 
GeneralRe: Drawing a bitmap into a CEdit Pin
Tomasz Sowinski7-Mar-02 0:39
Tomasz Sowinski7-Mar-02 0:39 
GeneralCButton Vertical Text Pin
Chandram6-Mar-02 20:25
Chandram6-Mar-02 20:25 
GeneralRe: CButton Vertical Text Pin
Serge Krynine6-Mar-02 20:34
Serge Krynine6-Mar-02 20:34 
GeneralRe: CButton Vertical Text Pin
Serge Krynine6-Mar-02 20:37
Serge Krynine6-Mar-02 20:37 
GeneralRe: CButton Vertical Text Pin
Nish Nishant6-Mar-02 20:52
sitebuilderNish Nishant6-Mar-02 20:52 

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.