
Here's what I see - VC 9 compiler, debug build, no optimizations.
Without cast and with...
sprintf(bufff, "You have %d %s", howmany, kindOfFruit);
00420E5A mov esi,esp
00420E5C mov eax,dword ptr [ebp-24h]
00420E5F push eax
00420E60 mov ecx,dword ptr [ebp-30h]
00420E63 push ecx
00420E64 push offset string "You have %d %s" (446B88h)
00420E69 lea edx,[ebp-134h]
00420E6F push edx
00420E70 call dword ptr [__imp__sprintf (0A1E650h)]
00420E76 add esp,10h
00420E79 cmp esi,esp
00420E7B call @ILT+5270(__RTC_CheckEsp) (41649Bh)
sprintf(bufff, "You have %d %s", howmany, (LPCTSTR)kindOfFruit );
00420E80 mov esi,esp
00420E82 lea ecx,[ebp-24h]
00420E85 call dword ptr
[__imp_ATL::CSimpleStringT<wchar_t,1>::operator wchar_t const * (0A1EB98h)]
00420E8B cmp esi,esp
00420E8D call @ILT+5270(__RTC_CheckEsp) (41649Bh)
00420E92 mov esi,esp
00420E94 push eax
00420E95 mov eax,dword ptr [ebp-30h]
00420E98 push eax
00420E99 push offset string "You have %d %s" (446B88h)
00420E9E lea ecx,[ebp-134h]
00420EA4 push ecx
00420EA5 call dword ptr [__imp__sprintf (0A1E650h)]
00420EAB add esp,10h
00420EAE cmp esi,esp
00420EB0 call @ILT+5270(__RTC_CheckEsp) (41649Bh)
I'm open to any interpretation of which is more efficient :)
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++