Click here to Skip to main content
15,885,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle28-Oct-09 20:20
xbottle28-Oct-09 20:20 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
Randor 28-Oct-09 21:48
professional Randor 28-Oct-09 21:48 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle29-Oct-09 23:33
xbottle29-Oct-09 23:33 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
enhzflep28-Oct-09 21:53
enhzflep28-Oct-09 21:53 
AnswerRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 2:56
David Crow29-Oct-09 2:56 
QuestionRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 2:54
David Crow29-Oct-09 2:54 
Questionwhy optimization since program is trade-off between time and memory Pin
jianzhuhuai28-Oct-09 14:36
jianzhuhuai28-Oct-09 14:36 
AnswerRe: why optimization since program is trade-off between time and memory Pin
Rozis29-Oct-09 12:07
Rozis29-Oct-09 12:07 
If i understand you correctly you are wondered why a program optimized for speed uses more memory and a program optimized for size is mostly slower.

I think there are 3 ways to optimize a program:

1. Get rid of all unneeded code. Classic examples are:
- the programmer lost oversight of variables resulting in several variables holding the same value
- He's insecure what value is in a variable resulting in too many conditions asking the same question
- Using the wrong algorithm to solve a problem
This kind of optimizing is for free: you will end with a program that uses less memory and less CPU

2. If your program does not contain any unneeded code, the only thing left is trade between memory, CPU and time. Your program says: i need this number of sourcode lines to solve the problem. Thus you only can restate lines, change computation into memory usage. This kind of optimizing has its costs: less CPU is more memory and v.v.

3. Sometimes you can divide a CPU-consuming piece in several parts that can be done when the program waits for the user. This kind of optimizing essentially does nothing (it still consumes the same time) but changes the feeling of the user. (actually you are not manipulating the program but the user).

I think a more interresting question would be: how can you garantuee that your program does not contain any needless code....

Rozis
GeneralRe: why optimization since program is trade-off between time and memory Pin
jianzhuhuai31-Oct-09 5:35
jianzhuhuai31-Oct-09 5:35 
Questionwhy add member function in classview does not work for overloaded function operator <() Pin
jianzhuhuai28-Oct-09 14:15
jianzhuhuai28-Oct-09 14:15 
AnswerRe: why add member function in classview does not work for overloaded function operator <() Pin
«_Superman_»28-Oct-09 14:37
professional«_Superman_»28-Oct-09 14:37 
AnswerRe: why add member function in classview does not work for overloaded function operator <() Pin
Adam Roderick J28-Oct-09 18:30
Adam Roderick J28-Oct-09 18:30 
Questionconvert CString to const char * Pin
Manmohan2928-Oct-09 7:23
Manmohan2928-Oct-09 7:23 
AnswerRe: convert CString to const char * Pin
David Crow28-Oct-09 7:37
David Crow28-Oct-09 7:37 
AnswerRe: convert CString to const char * Pin
transoft28-Oct-09 7:39
transoft28-Oct-09 7:39 
AnswerRe: convert CString to const char * Pin
«_Superman_»28-Oct-09 7:56
professional«_Superman_»28-Oct-09 7:56 
AnswerRe: convert CString to const char * Pin
Kushagra Tiwari28-Oct-09 21:31
Kushagra Tiwari28-Oct-09 21:31 
QuestionOpenCV application error Pin
dSolariuM28-Oct-09 5:28
dSolariuM28-Oct-09 5:28 
QuestionRe: OpenCV application error Pin
David Crow28-Oct-09 5:34
David Crow28-Oct-09 5:34 
AnswerRe: OpenCV application error Pin
dSolariuM28-Oct-09 6:08
dSolariuM28-Oct-09 6:08 
QuestionRe: OpenCV application error Pin
David Crow28-Oct-09 6:18
David Crow28-Oct-09 6:18 
AnswerRe: OpenCV application error Pin
dSolariuM28-Oct-09 6:20
dSolariuM28-Oct-09 6:20 
QuestionRe: OpenCV application error Pin
David Crow28-Oct-09 7:17
David Crow28-Oct-09 7:17 
AnswerRe: OpenCV application error Pin
dSolariuM28-Oct-09 9:17
dSolariuM28-Oct-09 9:17 
GeneralRe: OpenCV application error Pin
David Crow28-Oct-09 9:43
David Crow28-Oct-09 9:43 

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.