The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Avarice on November 23, 2008, 07:32:28 PM

Title: Should I learn C?
Post by: Avarice on November 23, 2008, 07:32:28 PM
If a person knows ASM, is there a point to learning C afterward? I would think that anything you do in C takes the same amount of time in ASM?
Title: Re: Should I learn C?
Post by: Glenn9999 on November 23, 2008, 08:17:38 PM
It depends on whether you want to learn C or not for most part.  C, as most High-Level Languages have the purpose to try and simplify the expression of programming algorithms.  In other words, C should take much less time than assembler, both to get up to speed, and to develop functional algorithms.  In fact, most of the high-level languages were developed to address certain productivity deficiencies with ASM programming (machine efficiency high, programmer efficiency low).

On the other hand, if you are wondering if C would be a good thing when it comes to ASM, the answer is yes.  Generally that is because of the ten ton gorilla that is always in the room, Microsoft - it's their favored language (not to mention the Linux gearheads).  If you want to have much to do with the Windows API in any language, you need knowledge of C (and sometimes OO C++) to be able to understand the API documentation to interface with it.

I'm not sure if that's what you needed to know or not, but hopefully that helps some.
Title: Re: Should I learn C?
Post by: Avarice on November 24, 2008, 02:03:19 AM
I guess what I want to know is, is it worth the effort of learning? I don't want to manage ASM, C++, and Java; and then learn C. If I split my attention to all these different languages then I won't ever master one. I heard that C is a step above ASM in terms of being low-level and I want to know is it worth learning C. I wouldn't like to give up on C++ or Java because C++ is good for game programming, and Java is good just because there are lots of job opportunities for it. I want to be convinced I don't want to learn another language.
Title: Re: Should I learn C?
Post by: Glenn9999 on November 24, 2008, 02:06:27 AM
Quote from: Avarice on November 24, 2008, 02:03:19 AM
I guess what I want to know is, is it worth the effort of learning? I don't want to manage ASM, C++, and Java; and then learn C.

If you know C++ already, you know C.  Does that answer your question?
Title: Re: Should I learn C?
Post by: gwapo on November 24, 2008, 03:04:45 AM
Quote from: Glenn9999 on November 24, 2008, 02:06:27 AM
If you know C++ already, you know C. 

I don't think so. I'm a C++ programmer, but I don't know C as much as I know C++  :dazzled:

:bg

-chris
Title: Re: Should I learn C?
Post by: Glenn9999 on November 24, 2008, 03:17:40 AM
Quote from: gwapo on November 24, 2008, 03:04:45 AM
I don't think so. I'm a C++ programmer, but I don't know C as much as I know C++  :dazzled:

Maybe my understanding is incorrect?  As my understanding goes, C++ is a language upgrade to C (the ++ being the increment operator in C) which mainly brought C into being an object-oriented language.  Fundamentally, my understanding was always that
you could throw a correct source program developed in C into a C++ compiler and have it (basically) work right - in other words, much of C++ is fundamentally the same as C.  In other words, one who knows C++ knows C, but one who does know C doesn't necessarily know C++ (especially Object-Orientation).

http://en.wikipedia.org/wiki/C%2B%2B
Title: Re: Should I learn C?
Post by: Vortex on November 24, 2008, 09:01:34 AM
Hi Avarice,

If you decide to learn C, have a look at Pelles C. It's a free C development tool set with a nice IDE :

http://www.smorgasbordet.com/pellesc
Title: Re: Should I learn C?
Post by: gwapo on November 24, 2008, 09:24:42 AM
Quote from: Glenn9999 on November 24, 2008, 03:17:40 AM
Maybe my understanding is incorrect? 

Hi glenn,

You're right, but there are many things in C that's not C++.
http://www.research.att.com/~bs/3rd_compat.pdf

But most of it are compatibility issues that are easy to forget, especially if you're a lazy programmer like me  :bg

Cheers,

-chris
Title: Re: Should I learn C?
Post by: thomas_remkus on November 24, 2008, 04:35:08 PM
C is not C++. Look to the articles that are posted from the author of C++ and his comments will tell you that C++ is not "a better C" but a different language. It's too common a mistake. From the horse's mouth, he considers them two different languages.
Title: Re: Should I learn C?
Post by: ecube on November 24, 2008, 06:06:08 PM
Pelles C is the best lightweight compiler/ide ive found, it's truely a work of art. As far as your question, yes it's a great idea to learn c while programming with ASM aswell because it definitely does simplify things. Some things i've wanted to do i've struggled greatly trying to do it in masm(even though asm is my favorite language) so I just wrote it in c, compiled as a static link library and linked right into masm, problem solved.C also makes writting cross platform code alot eaiser, if you ever want to take that route.
Title: Re: Should I learn C?
Post by: vanjast on November 24, 2008, 07:28:12 PM
I'd learn as much as I can - understanding more languages gives you better insight into programming techniques (good or bad), as well as been more versatile in the job market.

The only problem you'll have, for example - is mixing the different language syntax's while editing your code. And you'll have to re-arrange your brain into that particular language syntax while coding.  :bg
Title: Re: Should I learn C?
Post by: Mark Jones on November 24, 2008, 08:16:27 PM
Quote from: Avarice on November 24, 2008, 02:03:19 AM
...I heard that C is a step above ASM in terms of being low-level and I want to know is it worth learning C...

Greetings. Curious, have you considered the marketability of both? Are you programming for fun, or profit? Because there is little market for assembly programmers, and C is the de-facto standard... so if you wanted to make a living from programming, then C is going to be a much better choice. (And likewise, if you just enjoy programming, then consider each equally -- many here use C/C++ for the bulk of an application, and use assembler for the speed-critical parts.)

C is nothing like ASM, even though people in the high-level-language crowd sometimes ironically refer to it as being "close to the hardware." Compared to say, Visual Basic, C is indeed much "closer" to working with the computer's hardware... but still C is vastly different from manipulating the registers and processor instructions as is done in assembler.
Title: Re: Should I learn C?
Post by: Avarice on November 24, 2008, 10:53:22 PM
I might like to become a computer engineer, so assembly would help to understand the hardware. I thank you guys for your advice and I will think about it for a while.  :clap:
Title: Re: Should I learn C?
Post by: GregL on November 24, 2008, 11:59:01 PM
Avarice,

If you already know C++, it's not a big deal, just a matter of learning the differences (http://david.tribble.com/text/cdiffs.htm).

Learning assembly language is one of the best things you can do to improve your programming skills.


[edit] added link.

Title: Re: Should I learn C?
Post by: Farabi on November 25, 2008, 11:41:39 PM
Avarice:
Why not learning C++? But if you understand about MASM you will automatically understand C++ because for me it is similiar. The only different is C++ return value can be defined as a structure and on MASM  is will only just a dword. I suggest you to studying C++ because there are many great open source software created with C++, its good for your skill. Try MinGW with Code::Blocks IDE.
Title: Re: Should I learn C?
Post by: Vortex on November 26, 2008, 08:21:21 AM
Hi Avarice,

You should know also that you can always use asm modules to support your C/C++ code where execution speed is critical.