• Lucid Dreaming - Dream Views




    Results 1 to 25 of 34

    Thread: C++ Problem

    Hybrid View

    1. #1
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      I like to think I'm a fairly competent programmer
      but I draw the line at assembly

      now, I've never done anything game orientated
      I'm primarily database and web server middleware

      but seriously,
      does DIY assembly *really* make that much of a difference?
      (with all it's portability & bug pitfalls and show-stoppers)

      maybe it's cause I change my mind too often
      A minor re-jig to C code vs. scraping and re-writing pages of assembly

      anyway....

    2. #2
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by Ynot View Post
      does DIY assembly *really* make that much of a difference?
      Assembly code is INSANELY fast. It also has a better memory footprint. I've never had a compiler make better asm than me (for small routines obviously.) Compilers are very liberal with the stack (liveliness analysis isn't very good), when I do something in asm I try to use the stack as little as possible, that usually means moving parts of the code around, which compilers have a hard time doing.

      I do graphics and when doing extensions for OpenGL or shaders, you have to use assembly because C just isn't fast enough, even with the 3 pass optimizer turned on.
      Last edited by ninja9578; 08-13-2008 at 03:02 AM.

    3. #3
      Banned
      Join Date
      May 2007
      LD Count
      Loads
      Gender
      Location
      Digital Forest.
      Posts
      6,864
      Likes
      386
      Okay, it worked, but it's taking forever to compile

    4. #4
      Banned
      Join Date
      May 2007
      LD Count
      Loads
      Gender
      Location
      Digital Forest.
      Posts
      6,864
      Likes
      386
      Actually, it didn't work.

      It just took forever and gave me 5x the errors...

    5. #5
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Must be your C++ code, asm should be really fast to compiler. What other flags did you set, are you doing multiple passes?

      As for your errors: see post above about referencing with asm.

    6. #6
      Banned
      Join Date
      May 2007
      LD Count
      Loads
      Gender
      Location
      Digital Forest.
      Posts
      6,864
      Likes
      386
      None and no.

      I just put gcc -o my_program -masm=intel my_program.c twice for the two (huge) files that use inline assembly.

      It still doesn't recognize __asm { }

    7. #7
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Quote Originally Posted by Seismosaur View Post
      It still doesn't recognize __asm { }
      GCC accepts either asm or _asm_. You need either no underscores or two.

    8. #8
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      I see some errors in the programmer, are you sure this program worked once?

      Code:
      mov bx, word ptr [edi]
      Pointers are 64-bit, bx is 16-bit

    9. #9
      Banned
      Join Date
      May 2007
      LD Count
      Loads
      Gender
      Location
      Digital Forest.
      Posts
      6,864
      Likes
      386
      Oh okay.

      Well I sure hope it did as it's a game engine for a video game that was once produced

      A few other people have managed to get it working, but I have limited contact with them.

    10. #10
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      I think most games are written in .NET which means a M$ compiler. I'm not sure if you can get that for free.

    Bookmarks

    Posting Permissions

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