I know that such a func is usable only in asm but except of this is it good or rather bad habit ??
Posted on 2003-07-05 13:14:55 by AceEmbler
personally i do it lots in my code hehe, although they are 'internal' procs, i guess it's a different scenario when you're making dlls with exports etc which might be used by other non asm type languages
Posted on 2003-07-05 13:28:04 by evlncrn8
Why not, if the calling function is expecting it where's the harm. After all the cpu may use edx:eax to return a multiply of eax, why not use it. As long as you don't flub up windows by not preserving the ebx:esi:edi resgisters on exit use them all, this is ASM not C and you are not bound by the limitations of that language.
Posted on 2003-07-05 13:29:53 by donkey
do what you want, as long as you document it well...
Posted on 2003-07-05 14:35:02 by f0dder
And as long as you remember what you did. :rolleyes:
Posted on 2003-07-05 20:12:08 by roticv
documentation takes care of that, roticv
Posted on 2003-07-06 05:15:59 by f0dder

And as long as you remember what you did. :rolleyes:



BTW sometimes i'm affraid of opening sources of my old projects, it's realy horrible when i have to repair something :eek:
Posted on 2003-11-21 11:42:38 by AceEmbler
I beleive c allows 64 bit return values in edx:eax
Posted on 2003-11-21 12:18:31 by ENF

BTW sometimes i'm affraid of opening sources of my old projects, it's realy horrible when i have to repair something :eek:


That's why the documentation is important for all of us.
Posted on 2003-11-21 12:28:06 by Vortex

I beleive c allows 64 bit return values in edx:eax

'C' doesn't allow this - first of all, C is platform independent, and even on x86 there's no _rule_ as to how things are returned (luckily most vendors follow the 'standard rules'). Also, 64bit integer types aren't really defined by the standard, so...
Posted on 2003-11-21 12:42:52 by f0dder
Perhaps what I meant to say was that in my experience I have seen programs created in c that do this and just assumed it was a c standard.
Posted on 2003-11-21 14:56:30 by ENF
I too have seen this behavior in C compilers. When a function returns a 64-bit value it expects the low dword in EAX and the high dword in EDX.
Posted on 2003-11-22 08:42:34 by QvasiModo
Ace,

There is nothing wrong with using ECX and EDX as return values as long as you comment your code so you know what its doing. If you want the code to usable from C in a module, you can make the extra return values available to the C programmer by passing the address of values that you fill in the procedure you write. It takes a few extra instructions but it rarely ever matter in performance terms and if it does, inline the code anyway.

Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
Posted on 2003-11-23 17:51:38 by hutch--