Like Tree9Likes
  • 1 Post By Bayint Naung
  • 5 Post By grumpy
  • 1 Post By Adak
  • 2 Post By CommonTater

WHY IS GCC NOT AS GOOD AS OLD TurboC??

This is a discussion on WHY IS GCC NOT AS GOOD AS OLD TurboC?? within the C Programming forums, part of the General Programming Boards category; I cant understand why the great gcc compiler is so painful.It doesnt accept float to int conversion,i.e,if u print a ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27

    Question WHY IS GCC NOT AS GOOD AS OLD TurboC??

    I cant understand why the great gcc compiler is so painful.It doesnt accept float to int conversion,i.e,if u print a float value with %d, then only integral part should print, but gcc doesnt allow it.Similarly, gcc doesnt allow the command clrscr();

    Also, when i use math.h header file for mathematical functions, gcc wants us to add the name of the library while compiling, making us write a long command for compilation.
    But, turboc is an age old compiler and doesnt fit with graph plotters like gnuplot,which i frequently use.

    Is there any way out of this dilemma over choice of compilers?Any suggestions please?I want to ge accustomed with any ONE compiler, as i am a beginner and have a long way in C programming.

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    This post showed how ignorant you are. Rather learn real standard C.
    Salem likes this.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27

    Unhappy

    Quote Originally Posted by Bayint Naung View Post
    This post showed how ignorant you are. Rather learn real standard C.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,662
    Quote Originally Posted by suryap.kv1bbsr View Post
    It doesnt accept float to int conversion,i.e,if u print a float value with %d, then only integral part should print, but gcc doesnt allow it.
    According to the standard, printing a float value with %d gives undefined behaviour. gcc is actually doing you a service by rejecting that: with other compilers, you may get a crash on doing that.

    If you want to print a float as an integer, convert it to an integer first, and then print that. That is guaranteed to work correctly with all compilers.

    Quote Originally Posted by suryap.kv1bbsr View Post
    Similarly, gcc doesnt allow the command clrscr();
    clrscr() is a non-standard function, that is specific to a few old (targeting DOS) compilers - such as Turbo C.

    If you insist on using non-standard functions, one of the consequences you must accept is that your code will be rejected by other compilers.

    Quote Originally Posted by suryap.kv1bbsr View Post
    Also, when i use math.h header file for mathematical functions, gcc wants us to add the name of the library while compiling, making us write a long command for compilation.
    You view the addition of four characters (-lm and a space) as making you write a "long command line"???? Give me a break.

    The only difference is that Turbo C IDE links in the math library by default.

    It is an accepted convention under unix that math libraries are not linked by default. gcc primarily targets unix platforms, so it follows that convention.

    Quote Originally Posted by suryap.kv1bbsr View Post
    But, turboc is an age old compiler and doesnt fit with graph plotters like gnuplot,which i frequently use.
    Them's the breaks. It is hardly surprising that a package named gnu plot will be targeted for a gnu compiler (gcc).

    Quote Originally Posted by suryap.kv1bbsr View Post
    Is there any way out of this dilemma over choice of compilers?Any suggestions please?I want to ge accustomed with any ONE compiler, as i am a beginner and have a long way in C programming.
    My suggestion is to get over your fixation of only using one compiler.

    In the real world, people have to use multiple compilers. It is called "use the tool that works for the job at hand". No compiler (or its associated library) is perfect, so sometimes you will find yourself using different compilers - depending on your task at hand.

    In practice, apart from the question of library functions and compiler-specific features, using multiple compilers actually helps you learn C better. What one compiler picks up, another may not. Writing your code so it sails cleanly past multiple compilers - and works correctly - tends to give code that is easier to port between compilers.

    In practice, you will be better off with gcc than an old compiler like Turbo C. Not because Turbo C is a bad compiler - it is not. But the C language (as specified in the standard) has changed since that compiler was shipped.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Turbo C was undoubtedly a great product, and it was tailored specifically to the best standard at that time (AT&T), and had some nice extensions, also.

    For small console or low level graphics programs, I still use it a great deal. But time has marched on, and a host of new C commands have been added. You'll miss a lot if you stay with just Turbo C - BIG arrays for one thing!

    Your complaints have generally easy work-arounds, but you won't learn them "kicking against the concrete". You'll mostly just hurt your toes.

    My advice is to move over to Pelles C (a free C compiler available for several different systems). It has some of the nice extensions that Turbo C has, but also a whole host of modern C functions are supported. It's IDE is intuitive, but modern, everything you typically want, nothing you don't.

    You will love Pelles C, or your money back!

    You shouldn't be printing out a float with %d, without first converting it to an int. C'mon! That has to be THE worst reason for sticking with an obsolete IDE and compiler, that I've ever heard.

    Don't misunderstand me, I loved Turbo C/C++ 1.01 - but time has moved on. That's the reality we live in, and I love having big arrays available.
    suryap.kv1bbsr likes this.

  6. #6
    Registered User TheBigH's Avatar
    Join Date
    May 2010
    Location
    Melbourne, Australia
    Posts
    426
    Trying to print a float as an integer is bad programming practice, and not strictly legal C. One of the two compilers you're comparing complains about it, and the other sweeps it under the carpet. Gcc is not the problem here.

    By the way,
    Code:
    gcc -o thebigh thebigh.c -lm -O3 -Wall -Wextra -pedantic
    FOR THE WIN!
    Last edited by TheBigH; 03-25-2011 at 05:50 AM. Reason: fix

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by suryap.kv1bbsr View Post
    I cant understand why the great gcc compiler is so painful.It doesnt accept float to int conversion,i.e,if u print a float value with %d, then only integral part should print, but gcc doesnt allow it.Similarly, gcc doesnt allow the command clrscr();

    Also, when i use math.h header file for mathematical functions, gcc wants us to add the name of the library while compiling, making us write a long command for compilation.
    But, turboc is an age old compiler and doesnt fit with graph plotters like gnuplot,which i frequently use.

    Is there any way out of this dilemma over choice of compilers?Any suggestions please?I want to ge accustomed with any ONE compiler, as i am a beginner and have a long way in C programming.
    You don't understand why it won't accept non-standard C programming?
    Wow, one would think that's a total no brainer...

    First off, you've got to understand that Turbo C is a 16bit comipler, the programs it produces already won't run on 64 bit Windows and may not run on the next generation of 32 bit windows. It is an obsolete compiler, producing obsolete code that only works on onbsolete hardware... it's time to move on.

    Second; in case you haven't noticed, almost nobody is writing console mode programs anymore. It's all Windows GUI now. Unless you have a compiler and libraries capable of GUI code, and learn your way around Windows API your C programming career will end in very short order. (You don't really think: "Fully qualified on a 25 year old compiler of DOS programs" is a selling point in today's market, do you?)

    What you need to do here is learn to program to the C89 and/or C99 standards, both of which are incorporated into GCC and MinGW (the windows version of GCC).

    If you'r not liking the GCC experience you can switch to Pelles C, as already suggested. It is a fully C-99 compliant compiler with a real nice set of extra libraries provided.

    In any event... it's time you --and a great many others-- moved forward and stopped playing Fred Flintstone with those dinosaur age compilers.
    TheBigH and Salem like this.

  8. #8
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27

    Thumbs up thanks!!!!!!!!!

    actually wheni was introduced to turbo c i was told that it is very old but i though that it would be ok for the time being.....but now i have installed pelles c and code::blocks.....let me test which one is better as i would be taking the beginner's simulation course next semester

    thank you for your kind guidance!!!!!!!

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by suryap.kv1bbsr View Post
    actually wheni was introduced to turbo c i was told that it is very old but i though that it would be ok for the time being.....but now i have installed pelles c and code::blocks.....let me test which one is better as i would be taking the beginner's simulation course next semester

    thank you for your kind guidance!!!!!!!
    Ok, before you get all invested... take a close look at the IDE features of each.

    If you plan doing anything but CLI programming, you're going to hit the wall pretty quickly with Code:Blocks. CB includes no support whatsoever for windows resource (*.res, *.rc) files. If you plan building windows GUI mode apps, you will need to find free standing resource editors for dialogs, string tables, manifests, accellerators, icons, bitmaps, etc. And good luck finding a free standing Message Table editor, I've never seen one.

    PellesC has all this built right in.

    The only reason to choose Code::Blocks over Pelles is if you are doing C++ programming (Pelles is strictly C-99) but even then you'll still have to come up with all that extra stuff from someplace...

    I would recommend Pelles C for standard C programming... it's a beautiful IDE.
    For C++ get the free version of Visual Studio from Microsoft.

    IMO Code:Blocks is great for Linux but it massively sucks for Windows.

  10. #10
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27
    Quote Originally Posted by CommonTater View Post
    Ok, before you get all invested... take a close look at the IDE features of each.

    If you plan doing anything but CLI programming, you're going to hit the wall pretty quickly with Code:Blocks. CB includes no support whatsoever for windows resource (*.res, *.rc) files. If you plan building windows GUI mode apps, you will need to find free standing resource editors for dialogs, string tables, manifests, accellerators, icons, bitmaps, etc. And good luck finding a free standing Message Table editor, I've never seen one.

    PellesC has all this built right in.

    The only reason to choose Code::Blocks over Pelles is if you are doing C++ programming (Pelles is strictly C-99) but even then you'll still have to come up with all that extra stuff from someplace...

    I would recommend Pelles C for standard C programming... it's a beautiful IDE.
    For C++ get the free version of Visual Studio from Microsoft.

    IMO Code:Blocks is great for Linux but it massively sucks for Windows.
    Well i must tell u that i have installed pelles c over my windows partition which i seldom use,,but i am an active user of ubuntu linux,,,since i couldn't find pelles c version for linux,i installed code::blocks

    I am a beginner learning C and i haven't started windows g programming yet...but i will start it in a month.The main use of C for me is for simulations, graph plotting, etc. after solving a good amount of equations.I do not use mathematica and matlab as they are much slow and it is painful to have full control over them.
    My friend suggested that ROOT will come handy for simulations as it has both c/c++ compiler and a graph plotting tool in it.How is it?

    Once again, thanks for your help!

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    There is no linux version of Pelles C... it is strictly a windows development tool. While some may argue this is a weakness, it's actually one of it's strengths. It is very tightly coupled with the OS and highly optimized for it, giving it a clear advantage over multi-platform compilers.

    I know nothing about ROOT... Hadn't even heard of it before you mentioned it.

  12. #12
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27
    Quote Originally Posted by CommonTater View Post
    There is no linux version of Pelles C... it is strictly a windows development tool. While some may argue this is a weakness, it's actually one of it's strengths. It is very tightly coupled with the OS and highly optimized for it, giving it a clear advantage over multi-platform compilers.

    I know nothing about ROOT... Hadn't even heard of it before you mentioned it.
    ohh....actually i learnt that root is used only y simulators and scientists...thats why not popular

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compile Linux Kernel and GCC Version!
    By galactus51 in forum Linux Programming
    Replies: 0
    Last Post: 01-06-2011, 09:02 PM
  2. Replies: 4
    Last Post: 12-12-2010, 11:01 PM
  3. C and Cpp GCC Compiler Issues
    By Bangonkali in forum C Programming
    Replies: 15
    Last Post: 12-12-2010, 11:01 PM
  4. Undefined reference to.. probably Makefile problem
    By mravenca in forum C Programming
    Replies: 11
    Last Post: 10-20-2010, 05:29 AM
  5. gcc not for C++?
    By tin in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2004, 09:26 AM

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