Click here to Skip to main content
15,921,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Doc/View question Pin
J Patel7-Jan-02 11:30
J Patel7-Jan-02 11:30 
GeneralRe: Doc/View question Pin
alex.barylski7-Jan-02 11:50
alex.barylski7-Jan-02 11:50 
GeneralRe: Doc/View question Pin
Derek Waters7-Jan-02 12:11
Derek Waters7-Jan-02 12:11 
GeneralRe: Doc/View question Pin
alex.barylski7-Jan-02 12:23
alex.barylski7-Jan-02 12:23 
GeneralVariable Length Function parameter list Pin
slacker7-Jan-02 9:47
slacker7-Jan-02 9:47 
GeneralRe: Variable Length Function parameter list Pin
Joaquín M López Muñoz7-Jan-02 10:00
Joaquín M López Muñoz7-Jan-02 10:00 
GeneralRe: Variable Length Function parameter list Pin
Todd Smith7-Jan-02 11:47
Todd Smith7-Jan-02 11:47 
GeneralRe: Variable Length Function parameter list Pin
Tim Smith7-Jan-02 11:58
Tim Smith7-Jan-02 11:58 
That the will NOT work reliably. If you look at the code generated, there isn't a NULL pushed onto the stack. Thus, just by luck does this work when it does.

19:   int main()
20:   {
004010B0   push        ebp
004010B1   mov         ebp,esp
004010B3   sub         esp,44h
004010B6   push        ebx
004010B7   push        esi
004010B8   push        edi
004010B9   lea         edi,[ebp-44h]
004010BC   mov         ecx,11h
004010C1   mov         eax,0CCCCCCCCh
004010C6   rep stos    dword ptr [edi]
21:       int numArgs = CountArgs("blah", "1", "2", "3", "4");
004010C8   push        offset string "4" (00422030)
004010CD   push        offset string "3" (0042202c)
004010D2   push        offset string "2" (00422028)
004010D7   push        offset string "1" (00422024)
004010DC   push        offset string "blah" (0042201c)
004010E1   call        @ILT+5(CountArgs) (0040100a)
004010E6   add         esp,14h
004010E9   mov         dword ptr [ebp-4],eax
22:       return 0;
004010EC   xor         eax,eax
23:   }
004010EE   pop         edi
004010EF   pop         esi
004010F0   pop         ebx
004010F1   add         esp,44h
004010F4   cmp         ebp,esp
004010F6   call        __chkesp (00401120)
004010FB   mov         esp,ebp
004010FD   pop         ebp
004010FE   ret


Specifically in this case, the only reason this works is because EDI was 0.

Tim Smith
Descartes Systems Sciences, Inc.
GeneralRe: Variable Length Function parameter list Pin
Todd Smith7-Jan-02 12:33
Todd Smith7-Jan-02 12:33 
GeneralRe: Variable Length Function parameter list Pin
Nish Nishant7-Jan-02 18:34
sitebuilderNish Nishant7-Jan-02 18:34 
Generalchanging read-only CEdit background color Pin
Kuniva7-Jan-02 9:36
Kuniva7-Jan-02 9:36 
GeneralRe: changing read-only CEdit background color Pin
Joaquín M López Muñoz7-Jan-02 10:19
Joaquín M López Muñoz7-Jan-02 10:19 
GeneralRe: changing read-only CEdit background color Pin
Tim Deveaux7-Jan-02 10:30
Tim Deveaux7-Jan-02 10:30 
GeneralStored procedure ADO Pin
youssef7-Jan-02 8:35
youssef7-Jan-02 8:35 
GeneralSetMenuItemBitmaps() and GetSystemMetrics() Pin
7-Jan-02 8:25
suss7-Jan-02 8:25 
GeneralCTime, strftime, Format, %z/%Z Pin
Tomasso7-Jan-02 6:44
Tomasso7-Jan-02 6:44 
GeneralRe: CTime, strftime, Format, %z/%Z Pin
Mike Eriksson8-Jan-02 0:03
Mike Eriksson8-Jan-02 0:03 
GeneralWebBrowser-Control: FileDownload-Event Pin
7-Jan-02 5:46
suss7-Jan-02 5:46 
GeneralUNICODE file I/O Pin
7-Jan-02 5:15
suss7-Jan-02 5:15 
GeneralRe: UNICODE file I/O Pin
7-Jan-02 5:55
suss7-Jan-02 5:55 
GeneralEmbed objects with custom icons in a CRichEditCtrl Pin
7-Jan-02 3:45
suss7-Jan-02 3:45 
GeneralAdding buttons Pin
Rickard Andersson207-Jan-02 3:07
Rickard Andersson207-Jan-02 3:07 
GeneralHelp with CRectTracker Pin
Eugene Pustovoyt7-Jan-02 2:02
Eugene Pustovoyt7-Jan-02 2:02 
GeneralRe: Help with CRectTracker Pin
Roger Allen7-Jan-02 4:43
Roger Allen7-Jan-02 4:43 
GeneralRe: Help with CRectTracker Pin
Eugene Pustovoyt7-Jan-02 19:29
Eugene Pustovoyt7-Jan-02 19:29 

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.