Convert the following C++ code into assembly please quickly
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Convert the following C++ code into assembly please quickly

  1. #1
    Join Date
    Apr 2013
    Posts
    6

    Convert the following C++ code into assembly please quickly

    int x, y;
    while(x > y--)
    {
    if (x>0 && y<0)
    x = y = pow(x , y);
    else if(--x > y++)
    x = x && y;
    else
    y = ( x & y)>> 3;

    }
    Last edited by manarzaid; May 1st, 2013 at 10:43 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,872

    Re: Convert the following C++ code into assembly please quickly

    Why? What do think this c++ code is achieving? It looks fairly nonsensical. It doesn't even set initial values for x and y.
    Last edited by 2kaud; April 30th, 2013 at 02:27 PM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.5.0)

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,872

    Re: Convert the following C++ code into assembly.

    You're already posted this. Please don't repost.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.5.0)

  4. #4
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,735

    Re: Convert the following C++ code into assembly.

    Duplicate posts (aka SPAM) are being removed. Please consider this your only warning that duplicate posts are considered spam and can result in you being banned from the forum.

    Also - this sounds like homework (which most of us won't help with). Why not just stick this into your compiler and let it generate the assembler code for you? Edit: Just looked at the code. I agree with what has been said - it is junk code, so this must be homework!

    Brad! Jones
    Admin
    Last edited by Brad Jones; April 30th, 2013 at 02:50 PM.
    -----------------------------------------------
    Brad! Jones,
    LotsOfSoftware, LLC
    -----------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)