Sign in to follow this  

Gotchas with _asm in vc6/net2k3

This topic is 4687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

msdn states:
Quote:
When using __asm to write assembly language in C/C++ functions, you don't need to preserve the EAX, EBX, ECX, EDX, ESI, or EDI registers.
This is only partially true. This happens only if microsoft's compiler understands the instructions. If you have to implement an instruction via __asm __emit which has side effects on registers, you'll have to save/restore them manually. Probably obvious in hindsight, but it took us a few days to catch this bug in some older vc++ code which had been recompiled under net2k3. net2k3 has some funky optimizations (eg oddly dedicating ebx as a '0 register' throughout an entire large function, by setting it as 0 at the beginning and expecting it to remain 0), the code worked under vc6 but crashed under .net2k3.

Share this post


Link to post
Share on other sites

This topic is 4687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this