========= case 1 ========= both fun1() fun2() called in main() have default parameters ------test71.cpp------- #include int fun1(int x=10); int fun1(int x) { printf("fun1() x=%d\n"); return 0; } int fun2(int x); int fun2(int x=10) { printf("fun2() x=%d\n"); return 0; } // cl /Fatest71.asm test71.cpp void main() { fun1(); fun2(); } -------test71.asm--------- TITLE test71.cpp .386P include listing.inc if @Version gt 510 .model FLAT else _TEXT SEGMENT PARA USE32 PUBLIC 'CODE' _TEXT ENDS _DATA SEGMENT DWORD USE32 PUBLIC 'DATA' _DATA ENDS CONST SEGMENT DWORD USE32 PUBLIC 'CONST' CONST ENDS _BSS SEGMENT DWORD USE32 PUBLIC 'BSS' _BSS ENDS _TLS SEGMENT DWORD USE32 PUBLIC 'TLS' _TLS ENDS FLAT GROUP _DATA, CONST, _BSS ASSUME CS: FLAT, DS: FLAT, SS: FLAT endif PUBLIC ?fun1@@YAHH@Z ; fun1 EXTRN _printf:NEAR _DATA SEGMENT $SG580 DB 'fun1() x=%d', 0aH, 00H _DATA ENDS _TEXT SEGMENT ?fun1@@YAHH@Z PROC NEAR ; fun1 ; File test71.cpp ; Line 8 push ebp mov ebp, esp ; Line 9 push OFFSET FLAT:$SG580 call _printf add esp, 4 ; Line 10 xor eax, eax ; Line 11 pop ebp ret 0 ?fun1@@YAHH@Z ENDP ; fun1 _TEXT ENDS PUBLIC ?fun2@@YAHH@Z ; fun2 _DATA SEGMENT ORG $+3 $SG586 DB 'fun2() x=%d', 0aH, 00H _DATA ENDS _TEXT SEGMENT ?fun2@@YAHH@Z PROC NEAR ; fun2 ; Line 16 push ebp mov ebp, esp ; Line 17 push OFFSET FLAT:$SG586 call _printf add esp, 4 ; Line 18 xor eax, eax ; Line 19 pop ebp ret 0 ?fun2@@YAHH@Z ENDP ; fun2 _TEXT ENDS PUBLIC _main _TEXT SEGMENT _main PROC NEAR ; Line 22 push ebp mov ebp, esp ; Line 23 push 10 ; 0000000aH call ?fun1@@YAHH@Z ; fun1 add esp, 4 ; Line 24 push 10 ; 0000000aH call ?fun2@@YAHH@Z ; fun2 add esp, 4 ; Line 25 pop ebp ret 0 _main ENDP _TEXT ENDS END ========= case 2 ========= fun1() called in main() has default parameters fun2() called in main() does not have default parameter ------test71.cpp-------- // cl /Fatest71.asm test71.cpp #include "test71a.h" void main() { fun1(); fun2(); // error: function does not take zero parameter } ------test71a.h-------- int fun1(int x=10); int fun2(int x); ------test71a.cpp-------- #include int fun1(int x) { printf("fun1() x=%d\n"); return 0; } int fun2(int x=10) { printf("fun2() x=%d\n"); return 0; }