Jump to content
  • Advertisement
Sign in to follow this  
bani

Gotchas with _asm in vc6/net2k3

This topic is 4936 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
Advertisement
Very intresting. Thanks for the heads up. I doubt I will ever have a need to use __asm __emit in my programming stuff, but you never know, right? [smile] I'll keep this in mind...

- Drew

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!