Which C compiler should students and professors use in 2018

Posted on Posted in Blogs, Technology

C is a programming language originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs. That’s almost 50 years ago, but still it is the most popular programming language in Indian(if not the entire world’s) colleges and universities. I shall not explore the ‘why’ of it in this blog though. I am more interested in the ‘how’ of it, i.e. C compiler in 2018.

C compilers:

High level programming languages are written in English, but a computer understands only binary. That is, the hardware circuits responds to only a presence or absence of a voltage(1 or 0). The earliest programs were essentially written in binary where groups of binary digits(Hex codes) were mapped to certain operations(through complex electronic circuits). This mapping is called the instruction set of the processor. People than assigned English words or groups of letters(ADD, SUB, etc.) to these hex codes and wrote them down on a piece of paper in a sequential form to instruct the computer to do a particular task. When the program(written in English) was ready to be fed to the computer, programmers had to refer to the instruction set again and manually type in the hex code corresponding to each English word. You’ll get a better understanding of this process in your microprocessor subject of your college/university course.

To get around this complex process, people invented high level languages, which were written in English and the mapping of English to Hex codes was automatically done by a compiler. C is one of the early high level languages. It was designed to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. Over the years, the language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. So C has to run on a number of different processors with different instruction sets. So different compilers were written for different platforms.

[Here we have assumed a level of abstraction between the operating system and the actual processor chip. For example all windows XP running machines may not have the same processor, but we have the same C compiler working on them. The compiler interacts with the OS rather than the processor.]


C compilers used in colleges/universities

When I was a first semester student in my engineering, all the computers in our laboratory ran on windows XP. We used Turbo C compiler, which is also an Integrated Development Environment(IDE), in college computers and also in our personal computers. By our third semester however, with the whole open source movement, our college adopted linux OS and consequently GCC compiler for C and C++. Note that it is just a compiler and not an IDE, so we had to write the programs in the default text editor and compile from the terminal. And with newer versions of windows, we had to move to new compilers for our personal computers too, like visual C++.

This whole process added complexities and confusion to the already complex business of programming. For a new college student, who has not learned much about hardware and compilers, this is a huge obstacle in the path to become a good programmer. Many students lose interest in programming in the early phase of their course and resort to memorizing programs just to pass.


The solution:

Thank God its 2018 and we can have the exact setup for programming in all major platforms. The setup I am suggesting here is GCC compiler and Visual Studio Code(VS Code) editor for all three major operating systems(windows, linux and macOS). GCC in windows can be installed via minGW. In linux and macOS it can be directly installed through the terminal, though it may be a bit complex in mac. This is a good video tutorial by Derek Banas on how to install GCC in windows and mac:

Then just install VS Code, which is a code editor that runs on all three platforms. The added benefit of using VS Code over other editors is that it has an integrated terminal inside it. So you can compile and run the C programs from within the editor. Thus VS Code feels more like an IDE like turbo C.

Teachers should encourage (1st semester*)students to install the whole setup themselves and teach them the basics about compilers, editors vs IDEs and terminal/command prompt uses. This will certainly increase interest in programming among students.

Additional advantages of using VS Code:

VS Code has intellisense, which is a feature by which the editor can point out errors while you are typing a program.

Here, I missed a semicolon in line number 8, and the error is prompted while typing the program.

Debug and git are also integrated, which are two important things students should learn outside of their curriculum which will help them in getting better jobs.

Moreover you can write most of the programming languages in VS Code, be it java or html/css or any other. Most of the professional web developers have already made it their default text editor. So you need not change your tools while transitioning from a student to a professional.



If you liked this article please comment and show your support and interest so that I’ll be motivated to continue this effort. Like our facebook page if you haven’t already.