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

C / C++ / MFC

 
AnswerRe: a garbage value from va_arg() Pin
__yb26-Oct-05 21:43
__yb26-Oct-05 21:43 
AnswerRe: a garbage value from va_arg() Pin
David Crow27-Oct-05 2:43
David Crow27-Oct-05 2:43 
Questionwhile (*p++); Pin
Chintoo72326-Oct-05 16:45
Chintoo72326-Oct-05 16:45 
AnswerRe: while (*p++); Pin
John R. Shaw26-Oct-05 16:58
John R. Shaw26-Oct-05 16:58 
GeneralRe: while (*p++); Pin
Anonymous26-Oct-05 17:53
Anonymous26-Oct-05 17:53 
GeneralRe: while (*p++); Pin
John R. Shaw26-Oct-05 19:08
John R. Shaw26-Oct-05 19:08 
GeneralRe: while (*p++); Pin
Chintoo72327-Oct-05 5:37
Chintoo72327-Oct-05 5:37 
GeneralRe: while (*p++); Pin
John R. Shaw30-Oct-05 16:09
John R. Shaw30-Oct-05 16:09 
Lets make it more accurate then:
// UNOPTIMIZED
//////////////////////////
343:      char* p = "123";
0043CA51   mov         dword ptr [ebp-14h],offset string "123" (004df014)
344:      while( *p++ ) {};
0043CA58   mov         eax,dword ptr [ebp-14h] // eax <- p
0043CA5B   movsx       ecx,byte ptr [eax]      // value_type = p[0];
0043CA5E   mov         edx,dword ptr [ebp-14h] // edx <- p
0043CA61   add         edx,1                   // edx <- edx + 1
0043CA64   mov         dword ptr [ebp-14h],edx // p <- edx
0043CA67   test        ecx,ecx                 // if( ecx is 0 )
0043CA69   je          main+4Dh (0043ca6d)     //     goto 0043CA6D
0043CA6B   jmp         main+38h (0043ca58)     // goto 0043CA51
345:      return 0;
0043CA6D   xor         eax,eax
0043CA6F   jmp         __tryend$_main$1+2Ch (0043cac0)


// UNOPTIMIZED
START_LOOP:
value_type = *p;
++p;
if( value_type == 0 )
    goto END_LOOP;
goto START_LOOP;
END_LOOP:



INTP
Every thing is relative...
AnswerRe: while (*p++); Pin
Christian Graus26-Oct-05 17:11
protectorChristian Graus26-Oct-05 17:11 
GeneralRe: while (*p++); Pin
Anonymous26-Oct-05 18:39
Anonymous26-Oct-05 18:39 
GeneralRe: while (*p++); Pin
Christian Graus27-Oct-05 12:00
protectorChristian Graus27-Oct-05 12:00 
GeneralRe: while (*p++); Pin
Chintoo72327-Oct-05 16:33
Chintoo72327-Oct-05 16:33 
AnswerRe: while (*p++); Pin
sunit526-Oct-05 19:26
sunit526-Oct-05 19:26 
GeneralRe: while (*p++); Pin
Ghasrfakhri26-Oct-05 20:24
Ghasrfakhri26-Oct-05 20:24 
GeneralRe: while (*p++); Pin
sunit526-Oct-05 23:13
sunit526-Oct-05 23:13 
AnswerRe: while (*p++); Pin
Roger Stoltz26-Oct-05 21:47
Roger Stoltz26-Oct-05 21:47 
AnswerRe: while (*p++); Pin
Carsten Leue27-Oct-05 2:23
Carsten Leue27-Oct-05 2:23 
GeneralRe: while (*p++); Pin
Chintoo72327-Oct-05 5:42
Chintoo72327-Oct-05 5:42 
GeneralRe: while (*p++); Pin
Carsten Leue29-Oct-05 11:09
Carsten Leue29-Oct-05 11:09 
AnswerRe: while (*p++); Pin
TheGreatAndPowerfulOz27-Oct-05 8:53
TheGreatAndPowerfulOz27-Oct-05 8:53 
GeneralRe: while (*p++); Pin
TheGreatAndPowerfulOz27-Oct-05 8:57
TheGreatAndPowerfulOz27-Oct-05 8:57 
GeneralRe: while (*p++); Pin
Chintoo72327-Oct-05 16:38
Chintoo72327-Oct-05 16:38 
GeneralRe: while (*p++); Pin
TheGreatAndPowerfulOz28-Oct-05 3:18
TheGreatAndPowerfulOz28-Oct-05 3:18 
Questionc++ question Pin
dizzzzy2326-Oct-05 16:17
dizzzzy2326-Oct-05 16:17 
AnswerRe: c++ question Pin
Christian Graus26-Oct-05 16:42
protectorChristian Graus26-Oct-05 16:42 

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.