Results 1 to 14 of 14

Thread: asm + c++

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    asm + c++

    what is the usefulness of using assembly in c++? speed?
    thanks
    Amon Ra
    The Power of Learning.

  2. #2
    Zaei
    Guest
    Speed, confusion (to the un-initiated =), the ability to look cool, the best way to destroy code portability... Lots of reasons =).

    Z.

  3. #3
    ChimpFace9000
    Guest
    I gotta say, im kinda tired of these kind of questions.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You should not learn assembly in conjunction with C++, it's already a mess as it is. If you want to look cool go ahead, but if you want any results, stay away from assembly.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    ok i will follow then... =) sorry chimpface, i just wanted to know
    Amon Ra
    The Power of Learning.

  6. #6
    Zaei
    Guest
    Ther will forever be questions that will be answered over and over. "C++, or Java?", "D3D or OGL?", "Is there really a God?"... Nothing will do except to swallow an angry RTFM, and answer.

    Z.

    PS: no offense, Amon Ra, just observing the kind of posts that I have seen in other places =).

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    There's no good answer for everyone, only an answer for someone, so althought it looks like the same question, it depends on who asks it. I gotta say that i've been answering same questions in different ways as I start to think in new ways, good thing about learning is that you'll become familiar with the subjectivity of all matters...
    lol, wasn't really what I was going to say, but doesn't matter
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    how would you tell if someone used c++ or c? (besides the OOP stuff)?
    Amon Ra
    The Power of Learning.

  9. #9

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    could i get some good tuts for c? thanks
    Amon Ra
    The Power of Learning.

  10. #10
    Zaei
    Guest
    No classes, the lack of exceptions, an exclusive use of malloc, are all good clues as to whether a program is C, or C++.

    Z.

  11. #11
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106
    Don't bother learning C before C++, just go straight into C++.
    Learn OO programming techniques.

    Learning C programming will make it harder to learn OO in C++.
    ****

  12. #12

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    ok.. thanks guys
    Amon Ra
    The Power of Learning.

  13. #13
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by kedaman
    OOP stuff, and Generic Stuff, exceptions as Zaei mentioned and new instead of malloc, C++ is backward compatible which allows C programmerse to program in C++, and just by experience you can show who's been using what.
    Not totally. This is valid C code (not for much longer if the standard gets its act together!):
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    main() {
        int *ptr = malloc(5 * sizeof(int));
    
        for(int i = 0; i < 5; ++i) {
            printf("%d", ptr[i]);
        }
    
        free(ptr);
    
        return 0;
    }
    Just try and compile that in a C++ compiler
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  14. #14
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Even if you can't derive it from the not-using of classes and such, there are some things that will help you. Parksies code for example would be neither C nor C++ by the exact standards . C++ standard does not allow this line:
    int *ptr = malloc(5 * sizeof(int));
    You need an explicit cast when casting a void* (as returned by malloc) to any other pointer type.
    neither does it allow this line:
    main()
    Every function needs a defined return type, C just assumes int.
    C standard does not allow this line:
    for(int i = 0; i < 5; ++i)
    variables may only be declared at the start of a block, that is, directly after an opening { bracket. You would have to write:
    main()
    {
    int i;
    // ...
    for(i = 0; i < 5; ++i)
    {
    // variables may be declared here
    // ...
    }
    }
    Another thing:
    typedef struct
    {
    // members:
    int i, s, e;
    } MYSTRUCT;
    This will only appear in code that was made to work with C, so you don't have to write
    struct MYSTRUCT st;
    Exclusive use of /* such */ comments is also a sign of C code. (Although most C compilers now support // and the current C standard requires it).

    That's all I can think of at the moment.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width