don't click here

C or ASM

Discussion in 'Technical Discussion' started by MarkeyJester, Aug 14, 2009.

  1. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,250
    510
    93
    Japan
    hmm there is one question I would like to add to this, is C as hard to understand as I have originally been thinking lately? I mean I sware that the S2 DisASM has been made to look as similar to C as possible, and I find that irritating, or is it just simply me being too sceptical about C and thus finding excuses and not wanting to try it, I mean everyone else makes it seem like a walk in the park.
     
  2. saxman

    saxman

    Oldbie Tech Member
    It took me YEARS to get C. Granted, had I not learned x86 assembly, I may still not be a C programmer today (I'm a rare exception to the rule -- most people find C much easier to understand than ASM; I was the other way around.) But I'll tell you something that really really helped me understand a lot of it. Look this up:

    Sam's Teach Yourself C in 24 Hours (second edition)

    It's by Tony Zhang, and it is a very easy to understand book. I say that after having read some other books on C and being confused. That's the best C book I've seen. I bought mine in a store when it was new, but you can find a free downloadable PDF version of the book online -- http://www.ebook3000.com/Sams-Teach-Yourse...ours_22564.html

    If you decide to follow that book, read it from the beginning, and follow it all in order. Skipping around, as you may imagine, can confuse you. Also, you may want to try some of the examples in the book. They really help make sure you know the stuff you read in the book.
     
  3. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    S2 Disasm like C, what!!! No, C doesn't look like assembly, C is it's own thing.

    Code (Text):
    1. #include <stdio.h> /* You include your headers and define variables here, btw, this is a comment =P */
    2. #include "header.h"
    3.  
    4. void durms(int wat, int lol)
    5. {
    6. &nbsp;&nbsp;&nbsp;&nbsp;printf("%d%d\n", wat, lol);
    7. }
    8.  
    9. int main()
    10. {
    11. &nbsp;&nbsp;&nbsp;&nbsp;int wat, lol = 2;
    12. &nbsp;&nbsp;&nbsp;&nbsp;durms(wat, lol);
    13. &nbsp;&nbsp;&nbsp;&nbsp;return 0;
    14. }
    Function/Main.c syntax.

    Code (Text):
    1. #ifndef __HEADER_H__
    2. #define __HEADER_H__
    3. #ifdef __cplusplus
    4. extern "C" {
    5. #endif
    6. extern void durms(int wat, int lol);
    7. #ifdef __cplusplus
    8. }
    9. #endif
    10. #endif
    Header syntax.

    Of course externalizing durms is pointless, but for the examples sake.
     
  4. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,484
    1,091
    93
    Long-term happiness
    Actually, I'll second this - a friend of mine at university had this book and I leafed though it a few times, later downloading a PDF - it seems fairly comprehensive and well - if the man of awesome says it's awesome, who am I to argue? ;P
     
  5. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    10
    0
    being an asshole =P
    You don't use 'extern' on normal function declarations even if they're external, only on external variable declarations. Using 'extern' with a function declaration is for declaring functions in dynamic libraries in GCC :P
     
  6. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    Hence, the not necessary, it's in the same file. =P I know how headers work.
     
  7. Chilly Willy

    Chilly Willy

    Just pining for the fjords Tech Member
    755
    21
    18
    Heart of NASCAR
    Doom CD32X Fusion
    I learned C by spending 10 minutes going over a concise C reference page. I've never seen how people take months - sometimes YEARS - to learn a computer language. Guess that's just me. Must suck to have to put so much effort into something I see as so simple. :(
     
  8. saxman

    saxman

    Oldbie Tech Member
    Everyone has different kinds of intelligence, and sometimes two people have the same kind of intelligence, but learn it in two very different ways. As I said, C was very very difficult for me to grasp, but when I tried x86 assembly, I learned it easily. Typically when someone hasn't programmed something before, they learn a higher level language first, not a lower level language. Yet, I understood the low-level stuff very quickly. Looking back, I think it had a lot to do with me over analyzing things in programming. Something technical became natural for me, whereas something a bit more grammar-oriented confused the crap out of me.

    I think the proof of it comes when I try to explain something. If you read through a post of mine where I try to describe how something works, sometimes I confuse more people than I help because I usually don't have the "basic description" that people are looking for. I can't give them that simple explaination sometimes because I'm not always good at explaining it that way, so I give a more confusing, more technical-oriented answer.

    In the end, I think it has a lot to do with how someone's brain is wired. Everyone is capable of understanding the same things, but how to get there is a problem with a solution unique to each individual.
     
  9. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,250
    510
    93
    Japan
    I know Exactly what you mean, I've been having this similar problem, great at Math, shit at English, kinda wish I paid more attention in school in that area.

    Anywho, I'm starting off with the guide Saxman had just flagged up some posts above, but was wondering, could someone recommend a good compiler of sorts? I'm looking for a simple yet effective compiler but am not sure of what would be best in my current situation as a beginner.
     
  10. saxman

    saxman

    Oldbie Tech Member
    Well I don't think it's necessarily the difference between math and English for me -- I'm pretty good with both. It's the complexity involved. Sometimes I can understand something that's very technical, whereas something that's supposed to be simple I'll get confused as crap over. My mom's said that about me practically my entire life, and I think she's onto something there.

    For a compiler, I recommend downloading Dev-C++ which comes with a compiler and other things. Although it hasn't been updated in a few years, and some people will acknowledge some bugs in it, it's overall a fine product for anyone (beginner and professional alike) who wants to write software. I use when I write any sort of C program. You'll need to be running Windows if you wish to use Dev-C++.

    You can grab Dev-C++ here -- <a href="http://www.brothersoft.com/dev-c++-65296.html" target="_blank">http://www.brothersoft.com/dev-c++-65296.html</a>
     
  11. TmEE

    TmEE

    Master of OPL3-SA2/3 Tech Member
    1,726
    2
    18
    Estonia, Rapla City
    T-04YBSC-A !
    Only reason I am learing a new ASM every once in a while is that ASM makes more sense to me, and I hate the syntax of C......
     
  12. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    10
    0
    being an asshole =P
    Isn't Dev-C++, like, outdated and not maintained anymore? Most people using Dev-C++ had moved to Code::Blocks using MinGW (the compiler used in Dev-C++) already.

    That said, most Windows purists will insist in using Visual Studio. But to be fair, Visual Studio is one of the most bloated shits out there. Yeah, I can understand that there are programmers who like all the features it has, but considering I *barely* use the advanced features (at most I *may* need to debug something, and nothing more) and that the damn thing takes a shitload of time to load, I prefer to avoid it.
     
  13. AamirM

    AamirM

    Tech Member
    I used to HATE the syntax of C/C++ when I started to look some sample code and was learning it. Now I love it and can't really stand anything else [insert VB/VB.NET/PHP/Python/Ada etc...].

    Disable intellisense and install Visual Assist X. Really awesome tool.
     
  14. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    10
    0
    being an asshole =P
    It still won't prevent it from taking one whole minute exclusively to boot. Is my computer slow? Maybe, but there is no justification to take up that long. Even Sonic '06 loads faster.
     
  15. AamirM

    AamirM

    Tech Member
    It only takes long when its loading for the first time. After that, it loads up quickly for me. Also, get SP1 for VS2008. It got a bit fast for me after I installed SP1.
     
  16. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    10
    0
    being an asshole =P
    I used it several times and I assure you, it does not speed up. Code::Blocks is a resource whore too but nowhere near Visual Studio.
     
  17. AamirM

    AamirM

    Tech Member
    Yes. :P
     
  18. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    10
    0
    being an asshole =P
    Explain me how the hell can an IDE take up 1 minute to load. This computer is slow, but not that slow. It isn't a 386 :P
     
  19. saxman

    saxman

    Oldbie Tech Member
    Like I said, it hasn't been updated in a few years. But it's a decent program. I can't recommend Code::Blocks personally because I've never really used it, but I have read it's pretty good. Either way though, I don't know that using one program over the other is going to make much difference.
     
  20. AamirM

    AamirM

    Tech Member
    You just answered your own question. Plus, have you REALLY measured that it takes 1 minute? Maybe its just taking 15-20 secs to load.

    Personally, I don't use Visual Studio myself for C/C++ much except for debugging or if I have to do something in C# and/or ASP.NET. But I think its great for new learners and I think its much better than the free alternatives out there.

    For C/C++, I just use Textpad/Notepad + makefiles.