Wednesday, January 4, 2012

The C Beginnings: part 3



A couple of days back, someone left a comment on the C Language discussion page of this blog stating that a compiler(miracle compiler) was giving issues/errors. So today in this post, I want to focus on the different type of C compiler I have come across and highlight their advantages/features and the major disadvantage or difficultly that may be experienced in using them. I shall keep it very brief, here goes:

Dev C++  This is an open source (GNU) compiler developed by  ”bloodshed”. It can compile both C and C ++ source files, it can be used to write and edit header and resource files in addition to its primary use for C and C ++. It has ready-made template and can be used to develop windows Applications, Console Applications, DLL (digital linkage library) files.
A major difficulty a beginner might have with this compiler (especially if that person doesn’t know anything about the command prompt) is how to run the compiled source file(i.e. the generated  .exe file). 
A snapshot of the Dev C++ compiler
If the run button is clicked on the user interface of the compiler, it often opens the command prompt, runs the code and closes the command prompt, all these happen so fast that the user does not have enough time to see/view solution or the results of the written program that is displayed on the command line.
A simple solution to this is to put the whole code in a perpetual loop (usually a continuous while loop), for example
int main()
{
while(1)
{
                                // your code goes into this place
}
}
When the code is run, the while loop will prevent the command prompt from closing and the display on the command line can be read. If you wish to close the command prompt just close the command prompt window…
Another method is to place this 

getchar(); 

just before the  return 0;   in your code. This will force the command window to remain open until a character on the keyboard is pressed.
This compiler is free and available for download at their website http://www.bloodshed.net   you can check out their forum here http://www.bloodshed.net/forum
 
Borland C ++   is a C and C++ programming environment (that is, an integrated development environment) for MS-DOS and Microsoft Windows. It was the successor to Turbo C++, and included a better debugger, the Turbo Debugger, which was written in protected mode DOS.
A snapshot of the Borland C++ compiler
This compiler solves the problem encountered in the Dev C ++ compiler by running the compiled (.exe) file and displaying the results in an environment(like notepad) made by the compiler developers. This method takes the burden of having to run the file in the command prompt off the user by providing an easy way to see the results of the program/application. It is easy to use and has a simple user interface; most people find this compiler the best for them when they begin their journey into C programming.
 
You can check their website for more details on how to download the commercial one or the free one. Just go to this address http://www.borland.com  



Visual C ++  This compiler is made by Microsoft, it is a commercial  compiler even though a free version is available. It has a robust integrated development environment (IDE) for the C, C++, and C++/CLI programming languages user interface.  
A snapshot of the Microsoft's Visual C++ compiler

  It has tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework .I personally think this compiler is too big in terms of size occupied by it on your computer when compared to other C compilers; it also uses a lot of system resources when compared to the other compilers I discussed above.

 
You can check their website(Microsoft visual C++) for more details on how to download the commercial one or the free one. Just go to this address  http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express 




Miracle C Compiler  
 The Miracle C Compiler runs under MS-Windows targeting MSDOS, all the  traditional C syntax are implemented in the compiler, including record (structures/unions) and enumerated data types, integer (int), long and floating point data types, user type definition, bit fields in structures, initializers for all data types.
Miracle C compiler snapshot
It spots a comprehensive library of functions, some example programs demonstrating compiler features and Windows Helpfile documentation is supplied with the installation package. To download this compiler point your browser to this address http://www.c-compiler.com

The above is just an overview of a few of the numerous available C compilers; it is not in any way a detailed list or even represents a large fraction of the available C compilers available today. It just merely shows you that compilers differ sometimes slightly while at other times very greatly from each other. My suggestion for you is to extensively read up materials on the compiler you wish to use before you use it. Some compilers introduce other keywords that are not present in the standard C library, so know your compiler well.


Happy New Year from Giga Frequency

No comments:

Post a Comment