Thread: compilers

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    1

    Lightbulb compilers

    Hi programmers

    i would like to ask some simple questions im just new to c programming actually i just started yesterday by searching in web and ended up in cprogramming.com which led me here.

    Question:
    1. are all the compilers the same?
    -i have downloaded a compiler Dev-C++ and i dont know what to do with that. i all know that i need a compiler i searched google web and typed in compiler and i choose Dev-C++,


    2. Is it okay to stick to Dev-C++?
    -should i use different compiler? or Dev-C++ is different from others?


    3. Is Turbo C also a compiler?
    -what is Turbo C? should i use it rather than Dev-C++?

    4. should i try to learn C first or C++
    - which is harder


    i dont know T_T i dont even know how to program and use this comppilers but im willing to learn i just have to learn the basics and some rules


    please help me anyone?

    thank you so much!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by WilliamFerida
    1. are all the compilers the same?
    No.

    Quote Originally Posted by WilliamFerida
    -i have downloaded a compiler Dev-C++ and i dont know what to do with that. i all know that i need a compiler i searched google web and typed in compiler and i choose Dev-C++,


    2. Is it okay to stick to Dev-C++?
    -should i use different compiler? or Dev-C++ is different from others?
    Dev-C++ is not a compiler. It is an integrated development environment (IDE). Its default C compiler is the MinGW port of gcc. It is fine to use the latest version of Dev-C++ with its default compiler, except that it is no longer maintained and has some bugs that could bite you. Its default compiler is a little old but still acceptable (at least until the next edition of the C++ standard is published sometime this year or next year, but if you're going to learn C, that doesn't matter).

    Quote Originally Posted by WilliamFerida
    3. Is Turbo C also a compiler?
    Yes.

    Quote Originally Posted by WilliamFerida
    should i use it rather than Dev-C++?
    No.

    Quote Originally Posted by WilliamFerida
    4. should i try to learn C first or C++
    - which is harder
    Pick one to start with. They are equally soft.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by WilliamFerida View Post
    1. are all the compilers the same?
    -i have downloaded a compiler Dev-C++ and i dont know what to do with that. i all know that i need a compiler i searched google web and typed in compiler and i choose Dev-C++,
    Not even close. You will find some compilers produce far better code than others and some are a lot easier to work with than others.

    As Laserlight already pointed out DEVC++ is not a compiler. It is an Integrated Development Environment (IDE) --basically an editor-- built to drive a certain compiler. In this case the MinGW compiler.

    2. Is it okay to stick to Dev-C++?
    -should i use different compiler? or Dev-C++ is different from others?
    Yes you should use a different setup. (Note that I didn't say "compiler") Dev C++ is what we call "Abandonware". It is no longer supported and it's developer no longer updates or improves it. Yes it still works but after years of neglect, you can do much better.


    3. Is Turbo C also a compiler?
    -what is Turbo C? should i use it rather than Dev-C++?
    Turbo C is another "Abandonware" product. This time going way back to the days of 16 bit code and pre-standards programming.

    4. should i try to learn C first or C++
    - which is harder
    C++ is orders of magnitude more complex than C.

    My own programming history started in the DOS/Pascal days but then Borland destroyed Pascal (long story). There was an interregnum of several years in which I didn't do much programming and I decided to pick up C since Pascal had become an abandoned language. I worked with C for about 6 years, mostly on a hobby level (hense my tag "Rogue C Dabbler") wrote quite a few programs, mostly for personal use. I found the transition to C++ almost impossible until just recently; this, as I discovered, was largely due to perspectives learned using Pascal and C. You will see my "breakthrough", just recently in the C++ section of this forum... and it wasn't pretty.

    C++ is a "superset" of C... that is to say that almost everything in C also works in C++. But not the other way around; a C compiler will be utterly baffled by C++ syntax. So there is some value in knowing both.

    Your best approach will depend in large part on how you learn. If you tend to "learn up", starting with simple things then adding new complexity as you go, starting in C is not a bad idea. However; if you tend to learn in blobs, holding certain concepts and measuring new knowledge against them, you may want to start with C++ and learn some C by osmosis, completing the study afterward. Then again if you are a "parallel learner", you may want to tackle both at once... It really is up to you.

    Your first C and C++ programs will be almost identical in any case. For example, the standard "compiler test" program written by most of us as our first program "Hello World!" will compile and work on either...
    Code:
    #include <stdio.h>
    
    int main(void)
     {
         puts("Hello World!");
         return 0;
     }

    Compiler wise...

    If you are only interested in C and you want an easy to use setup (IDE + Compiler) then I would recommend PellesC ... It comes with a heavily modified version of the LCC compiler, is C-99 standards compliant, has all the tools you need to make console and window programs and is very well documented. ( smorgasbordet - Pelles C )

    If you want to start with C++ I would suggest Code::Blocks. This setup comes with a new version of the the MinGw compiler which is both C and C++ standards compliant. It's very well done but it lacks some windows tools such as a resource editor and you will have to actively hunt down C++ documentation for it... ( Code::Blocks )

    Studies wise...

    Be ready to read A LOT of stuff... at the top of this section is a listing of C books, a similar listing is also posted to the C++ section. I will caution that you should beware the age of some of these books... both C and C++ have changed over the years.

    Hope this helps....
    Last edited by CommonTater; 01-23-2011 at 09:39 AM.

  4. #4
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    I disagree that C++ is superset of C.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Bayint Naung View Post
    I disagree that C++ is superset of C.
    Yet, oddly enough, every text I've been into just lately says exactly that...

    Thinking in C++ even went so far as to point out that most C programs can be recompiled as C++ programs with only minor changes... eg. typecasting malloc().

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    There is actually quite a lot of difference between C and C++.
    Incompatibilities Between ISO C and ISO C++

    C++ is only a semantic superset (everything C can do, C++ can do). It is not a syntactic superset (every valid C program is also a valid C++ program).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Salem View Post
    There is actually quite a lot of difference between C and C++.
    Incompatibilities Between ISO C and ISO C++

    C++ is only a semantic superset (everything C can do, C++ can do). It is not a syntactic superset (every valid C program is also a valid C++ program).
    Agreed. But recent experience has given me pause to wonder if the "They really are two separate languages" claim is entirely valid...

    There are differences between "real" C and the way C++ handles C code... which is part of what I was tripping over all these years....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. books with compilers
    By alyeska in forum C++ Programming
    Replies: 3
    Last Post: 12-11-2006, 03:30 PM
  2. C++ Builder Comparison
    By ryanlcs in forum Tech Board
    Replies: 14
    Last Post: 08-20-2006, 09:56 AM
  3. Is It Possible To Install Multiple Compilers?
    By mishna_toreh in forum C Programming
    Replies: 3
    Last Post: 05-13-2005, 07:32 AM
  4. Compilers for Windows
    By LegendsEnd in forum Windows Programming
    Replies: 2
    Last Post: 03-26-2004, 08:03 AM
  5. Compilers, Compilers, Compilers
    By Stan100 in forum C++ Programming
    Replies: 11
    Last Post: 11-08-2002, 04:21 PM