preserve eax in a "C++" void f(int* a); routine



if I have the routine
void f(int* a);
I have to save eax or not: example

; void f(int* a);
; 0eax, 4Ra, 8 Pa
f:
push eax
mov eax, [esp+8]
mov dword [eax], 900
pop eax
ret

and

;void g(int* a);
; 0Ra, 4Pa
g:
mov eax, [esp+4]
mov dword [eax], 900
ret

If f() and g() are called from a C or a C++ programme,
It is better f() or g() ?

.



Relevant Pages

  • Re: Why There are no Asm Apps
    ... I doubt it's much more difficult in ASM than `c`. ... mov D$edi + TSkinProgressBar_Position eax ... mov eax D$edi + TSkinProgressBar_Step ...
    (alt.lang.asm)
  • Re: Fastcode IsPrime B&V 0.8
    ... cmp eax, 2 ... mov esi, offset Primes + 512 ... mov eax, ebp ... xor edx, edx ...
    (borland.public.delphi.language.basm)
  • Re: Multi-Statements Lines
    ... So all those "speed reading" course people pay so much money for don't ... Uses eax ... mov ebx 1 | mov eax ebx ...
    (alt.lang.asm)
  • Re: US Military Dead during Iraq War
    ... Is it true that for C language routines we can not to save eax, ecx, ... mov eax, ...
    (alt.lang.asm)
  • Re: Some Internet functions for MsXp in asm
    ... Ritorna il numero degli Host trovati di nome "HostName" ... cmp dword @vettore, 0 ... mov eax, @hostname; nome come "12.2.2.2" ... mov eax, @hostname; nome come "www.google.com" ...
    (alt.lang.asm)