Shahzaib Mazari
Shahzaib Mazari

Reputation: 444

What is the difference between using Turbo C and GNU C/C++?

I just want to know that what is the difference between using Turbo C and GNU C/C++? Is there any real difference, or if I submit the .C file would that be the same thing?

Upvotes: 2

Views: 1927

Answers (2)

Gyanendra
Gyanendra

Reputation: 35

Remember that a programming language is a specification (written in some document). It is not a software.

TurboC

Is obsolete, and does not support (and, AFAIK, does not even claim to support) recent enough language standards like C11 or C++11 or C++14. The language accepted by TurboC is worse that what the recent language standards specify. Quite often, some code written for TurboC is not standard conforming, and won’t even compile on a standard conforming implementation (like GCC). TurboC is proprietary software; you cannot see its source code (legally).

GCC

Is supporting (almost all of) recent standards like C11 or C++14. GCC is free software, you can download legally, study, and improve its source code. Read What is free software and why is it so important for society? That fact alone makes me prefer GCC.

TurboC produces poor executable code (whose performance is not very good) GCC is able to optimize (when asked to, e.g. g++ -O2 …) and can produce executables having a good performance.

So you should use GCC, not TurboC, for your project.

Hint: compile with g++ -Wall -Wextra -g (to get all warnings & debug information). Improve the code till you get no warnings. Then use the debugger (gdb) till you believe you don’t have bugs. For benchmarking, add an optimization flag like -O2 (or even -O3 -march=native)

Use GCC with a good editor (e.g. emacs), and a version control system (e.g. git), and a build automation tool (e.g. GNU make)

Clang/LLVM

Is (mostly) a standard conforming free software C & C++ compiler, you could use it instead of GCC.

Upvotes: 2

πάντα ῥεῖ
πάντα ῥεῖ

Reputation: 1

Is there any real difference, or if I submit the .C file would that be the same thing?

Yes there would be a lot of differences and it would be almost certainly not the same thing. Turbo C/C++ was released decades ago without compliance for any standard definitions and never was updated regarding these.

It will start with differences in naming header files, e.g. iostream.h vs iostream, and end with lack of support for modern C++ syntactic sugar like range based for loops.

Just dump it. Turbo C/C++ isn't useful for anything nowadays to learn the language (even if some "professors" in India1 think it is, and insist of using it).


1) We really should start a campaign to convince the indian education public authorities to stop teaching the usage of Turbo C/C++. It's just a shame for a country that plays well with rocket science in competition with other tech leading countries in the world.
There's no reason to keep it. There are many modern compilers and IDE's available without any additional cost, and I can't see any reason why this restriction should be continued, or what they think is of value in education.

Upvotes: 6

Related Questions