Click here to Skip to main content
15,884,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: 2-dimensional array of strings Pin
sunit519-Dec-06 23:13
sunit519-Dec-06 23:13 
AnswerRe: 2-dimensional array of strings Pin
toxcct19-Dec-06 23:18
toxcct19-Dec-06 23:18 
AnswerRe: 2-dimensional array of strings Pin
sunit520-Dec-06 0:51
sunit520-Dec-06 0:51 
AnswerRe: 2-dimensional array of strings Pin
Sam Hobbs20-Dec-06 18:05
Sam Hobbs20-Dec-06 18:05 
Questionaccess violation Pin
neha.agarwal2719-Dec-06 22:42
neha.agarwal2719-Dec-06 22:42 
AnswerRe: access violation Pin
Naveen20-Dec-06 0:32
Naveen20-Dec-06 0:32 
QuestionMemory Leak in SQLExecuteDirect() Pin
apoorva_raje19-Dec-06 22:37
apoorva_raje19-Dec-06 22:37 
AnswerRe: Memory Leak in SQLExecuteDirect() Pin
James R. Twine20-Dec-06 4:04
James R. Twine20-Dec-06 4:04 
   How is the memory for szSQL managed?  I cannot see where it is allocated and freed.

   Some optimization points, take them or leave them (ignoring buffer overrun protection that should be added):

     1: You do not need to memset(...) the string buffer before you use it - sprintf(...) will NUL-terminiate it for you

     2: Do not use sprintf(...) as a replacement for strcpy(...) (in fact, that static string does not really need to be copied to a buffer to be executed)

     3: sprintf(...) returns the number of characters it put into the buffer, excluding the terminating NUL so you can use that value to eliminate the calls to strlen(...)

     4: I would cache the result of ((ARCAdminDlg*)(AfxGetMainWnd()))->mp_ARCSecDb->mp_arcTables[nIdx] within the loop and not evaluate it multiple times.

   In your loop body, implementing the tips in #1 and #3 will eliminate 70000 operations from your loop.

   Peace!

-=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites
(Please rate this post!)

GeneralRe: Memory Leak in SQLExecuteDirect() Pin
apoorva_raje20-Dec-06 22:52
apoorva_raje20-Dec-06 22:52 
QuestionImage segmentation Pin
Rishikant_Prince19-Dec-06 22:35
Rishikant_Prince19-Dec-06 22:35 
AnswerRe: Image segmentation Pin
567890123419-Dec-06 22:45
567890123419-Dec-06 22:45 
QuestionApplication Error Pin
Programm3r19-Dec-06 22:32
Programm3r19-Dec-06 22:32 
AnswerRe: Application Error Pin
Hamid_RT20-Dec-06 0:01
Hamid_RT20-Dec-06 0:01 
QuestionRe: Application Error [modified] Pin
Programm3r20-Dec-06 0:33
Programm3r20-Dec-06 0:33 
AnswerRe: Application Error Pin
Mila02520-Dec-06 1:47
Mila02520-Dec-06 1:47 
QuestionRe: Application Error [modified] Pin
Programm3r20-Dec-06 3:28
Programm3r20-Dec-06 3:28 
QuestionDisplay ActiveX Control in Shared Dll Pin
QuickDeveloper19-Dec-06 22:31
QuickDeveloper19-Dec-06 22:31 
QuestionHow can i create a Global Desktop Pin
SelvaKr19-Dec-06 22:29
SelvaKr19-Dec-06 22:29 
QuestionCListBox with lines? Pin
bosfan19-Dec-06 22:28
bosfan19-Dec-06 22:28 
AnswerRe: CListBox with lines? Pin
Monty219-Dec-06 22:41
Monty219-Dec-06 22:41 
GeneralRe: CListBox with lines? Pin
bosfan20-Dec-06 0:46
bosfan20-Dec-06 0:46 
AnswerRe: CListBox with lines? Pin
CPallini20-Dec-06 2:12
mveCPallini20-Dec-06 2:12 
AnswerRe: CListBox with lines? Pin
James R. Twine20-Dec-06 2:13
James R. Twine20-Dec-06 2:13 
QuestionHow can i disable an item of context popup menu when it appears on right click ? Pin
barunkumarsingh19-Dec-06 22:20
barunkumarsingh19-Dec-06 22:20 
AnswerRe: How can i disable an item of context popup menu when it appears on right click ? Pin
Hamid_RT20-Dec-06 0:02
Hamid_RT20-Dec-06 0:02 

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.