Inline Assembly C++ Help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Inline Assembly C++ Help

  1. #1
    Join Date
    Apr 2010
    Posts
    166

    Arrow Inline Assembly C++ Help

    Could someone please tell my how i can use the cin function in inline assembly

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Inline Assembly C++ Help

    Why would you do that? Why don't you explain what you try to achieve. You should avoid as much as possible inline assembly. For instance, for the x64 platform, inline assembly in VC++ is no longer supported.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Apr 2010
    Posts
    166

    Arrow Re: Inline Assembly C++ Help

    How can assembly become unsupported when it makes higher level languages

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,009

    Re: Inline Assembly C++ Help

    Quote Originally Posted by gaar321 View Post
    How can assembly become unsupported when it makes higher level languages
    Everything that was previously supported may "become unsupported" if the developer chose to break the support...
    And what could it have to do with the "higher" or "lower" level languages?
    Victor Nijegorodov

  5. #5
    Join Date
    Aug 2008
    Posts
    902

    Re: Inline Assembly C++ Help

    One of the major points to C++ is portability, and the second you include an _asm block, it becomes locked down to the x86 architecture, and as cilu said, the 64-bit version of MSVC does not support inline asm. You should instead stick to intrinsics.

  6. #6
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,885

    Re: Inline Assembly C++ Help

    The point of using inline assembly is to super-optimize a particular chunk of code---usually an inner loop. The idea is that 80% of the time is spent in 20% of the code, so you can focus your extreme optimizations on just a few places and see a significant benefit. Optimizing in the wrong place gives you almost no benefit for (potentially) a lot of work.

    cin is a means of reading input from the console. Reading input is always slow, and cin often blocks waiting for user input. This is beyond slow---the program may actually stop for a while. There is thus absolutely no point in trying to write inline assembly that includes console input.

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Inline Assembly C++ Help

    Quote Originally Posted by gaar321 View Post
    How can assembly become unsupported when it makes higher level languages
    Well, things like this happen. As I said, please explain what you try to accomplish, maybe we can help with suggestions.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #8
    Join Date
    Jul 2002
    Posts
    2,494

    Re: Inline Assembly C++ Help

    Agree that there is no sence to use cin in Assembly. Anyway, if you want to know how to use cin (or anything else) in Assembly, make C++ program and read its Assembly output.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center