Mathematical ability and C/C++

This is a discussion on Mathematical ability and C/C++ within the C++ Programming forums, part of the General Programming Boards category; I see, so they generally concentrate on one language, and do al little of some others, what are the most ...

  1. #76
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57
    I see, so they generally concentrate on one language, and do al little of some others, what are the most common ones that C++ programmers do?
    ~Thank you~

    some have it, some don't, watch out for those who do....

  2. #77
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >I see, so they generally concentrate on one language, and do al little of some others, <

    yeah this doesn't mean they don't master half of them it just means they usually start with a learning language(or not, i didn't) pick another one and then master that, and during or after pick up on some others.

    >what are the most common ones that C++ programmers do?

    that greatly depends on the job, but what seems typical is C/C++ programmers usually go for some at least minor knowledge Assembler.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #78
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57

    Question

    So once you know C++ and a little of Assembly, you pretty much have complete control over your computer?

    is assembly a lot faster to do than C++?
    and a lot harder?
    Last edited by UneducatedOne; 09-27-2001 at 03:25 AM.
    ~Thank you~

    some have it, some don't, watch out for those who do....

  4. #79
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    No unless you are using DOS or windows 9x you won't have
    access to certain stuft unless your a privilage user.

    is assembly a lot faster to do than C++?
    I don't think so but I would have to benchmark
    a assembly program compared to a c++ program.

  5. #80
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57
    So you still need a compiler for the assembly language?
    ~Thank you~

    some have it, some don't, watch out for those who do....

  6. #81
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I don't need a c compiler, you need an assembler and a linker.
    Your c compiler will probably come with some sort
    of assembler.

  7. #82
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57
    Is assembly mostly the same as C++?
    what is the difference?

    would my DevC++ compiler have an assembly compiler and linker?
    ~Thank you~

    some have it, some don't, watch out for those who do....

  8. #83
    Registered User
    Join Date
    Sep 2001
    Posts
    164
    You can use inline assembly in DevC++ but however it's quite annoying. Example:
    Code:
    long b = 5;
    long a = 5;
    
    asm("
    imul %1,%2
    "
    : "=r" (a) /* Move register back into 'a'*/
    : "r" (a), "r" (b) /* Put 'a' and 'b' into two registers */
    );
    
    printf("%d", a);
    This code will display the number '25' (provided I have written it correct). In clean assembly (MASM) it could be written like this:

    Code:
    .data
    frmt db "%d",0
    
    .code
    
    something PROC
    LOCAL a:DWORD, b:DWORD
    
    mov eax,a
    mov ecx,b
    imul eax,ecx
    invoke printf,ADDR frmt, eax
    
    something ENDP
    Last edited by gliptic; 09-28-2001 at 02:36 AM.
    // Gliptic

  9. #84
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >Is assembly mostly the same as C++?

    it's a considerable bit different.

    >what is the difference?

    asm is lower level more compicated, i can't really go into depth about the difference since i can't program assembly yet, but im slowly learning it.

    >would my DevC++ compiler have an assembly compiler and
    linker?

    well a quike look at the FAQ says yes,
    NOTE: its AT&T Assembler not Intel

    Example:
    int AdrIO ;
    static char ValIO ;

    void MyFunction(..........)
    {
    __asm("mov %dx,_AdrIO") ; // loading 16 bits register
    __asm("mov %al,_ValIO") ; // loading 8 bits register

    /*
    Don't forget the underscore _ before each global variable names !
    */
    __asm("mov %dx,%ax") ; // AX --> DX
    }

    Intel asm looks some waht different like this

    // taken from a post by DavidP

    void initGraph (void)
    {
    // might need an underscore here or two.
    asm {
    mov ax, 13h
    int 10h
    }
    }

    also remember this inline asmembler not pure asmembler, that is its compiled with a C program not on its own.

  10. #85
    Registered User
    Join Date
    Sep 2001
    Posts
    164
    Yes, you can access global variables with just the name preceded by an underscore but local variables has to be used in the way I showed.

    The difference between AT&T syntax and intel syntax is mainly that almost all instruction operands are swapped. For example in AT&T syntax you write 'mov src,dest' instead of 'mov dest,src' in intel syntax. That means that the example you showed (mov %dx, %ax) moves the value in dx to ax.

    The other difference is that you can't write 'mov DWORD PTR[eax], 5' instead you have to write 'movl (%eax), $5'.
    The 'l' after the instruction name tells the assembler that you want to write a DWORD to the memory position. All registers must have a '%' prefix but when you are using inline assembly in DevC++ you must add one more '%' (%%reg) because the '%' character is used to access arguments passed to the asm-statement. All immediate values must have a '$' prefix also.

    I think the AT&T syntax is quite annoying. The Intel syntax is much better together with VC++.
    Last edited by gliptic; 09-28-2001 at 02:40 AM.
    // Gliptic

  11. #86
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57
    So people generally learn C/C++ before assembly?

    alos, whats pascal. basic, qbasic, java and javascript?, all computer programming languages? all similar?
    ~Thank you~

    some have it, some don't, watch out for those who do....

  12. #87
    Unregistered
    Guest
    I learned assembler before C++ actually.

    BASIC/QBASIC: Simple languages which are RAD-tools but not as much features like C++. These languages are often 16-bit DOS.

    JAVA: Looks quite much like C++. It's platform independent because the code is compiled to pseudo instructions which are interpreted later. Applets (that's what applications done with Java are called) are mostly found on the Internet.

    JAVASCRIPT: Scripting language which also looks much like C++. Used on the client-side on the Internet to create more interactive pages.

    PASCAL: Quite good language. The new, Windows based Pascal is named Delphi. Delphi can be compared to Visual Basic but I think Pascal is a bit faster.

  13. #88
    Registered User UneducatedOne's Avatar
    Join Date
    Sep 2001
    Posts
    57
    Thank you.

    What is 'pseudo'?

    And those languages are the main ones?, I mean there is no others?, or there is, just not as easy to use or well known?

    ....
    ~Thank you~

    some have it, some don't, watch out for those who do....

  14. #89
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    > What is 'pseudo'?

    Kind of

    > And those languages are the main ones?, I mean there is no others?, or there is, just not as easy to use or well known?

    They're the more common ones. There's tons of them out there - they're just not used as much. If you wanted everything, you could throw in lisp, php, delphi, fortran, cobol, asm, and about a million others...

  15. #90
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Psuedo means fake.

Page 6 of 7 FirstFirst 1234567 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21