15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Choosing a Compiler 85<br />

3. Choose a compiler that has the best chance of being around years<br />

from now.<br />

• Most companies prefer using compilers from brand-name companies,<br />

like Intel or Microsoft.<br />

Even compilers from big-name companies are no guarantee against<br />

obsolescence. Microsoft has stopped supporting their compilers over<br />

the years, such as Microsoft Pascal and Visual Basic 6. So if you used<br />

either of these compilers to write a program, you had to change compilers<br />

when Microsoft stopped developing them.<br />

• Many people are choosing “open source” compilers.<br />

Open source simply means that the source code to the compiler is<br />

available freely to anyone. Not only does this mean that open source<br />

compilers are free (compared to the hundreds of dollars you can pay<br />

<strong>for</strong> a brand-name compiler from Intel or Microsoft), but open source<br />

also guarantees that the compiler can’t become obsolete due to lack<br />

of support.<br />

Book I<br />

Chapter 4<br />

Programming Tools<br />

If you use a compiler from a company that goes out of business, you’re<br />

<strong>for</strong>ced to transfer (or port) your program to another compiler, which means<br />

having to rewrite the program to run under a different compiler.<br />

Because anyone can examine and modify the source code to an open source<br />

compiler, anyone can make changes to the compiler to improve it. One of the<br />

most popular open source compilers is GCC (http://gcc.gnu.org),<br />

which stands <strong>for</strong> GNU Compiler Collection.<br />

Xcode, the free compiler that Apple distributes with every Macintosh computer,<br />

is actually the GCC compiler.<br />

Originally, GCC only compiled C source code, but later versions of GCC now<br />

compile several different languages, including C, C++, Java, Ada, and Objective-C,<br />

with more <strong>programming</strong> languages being supported every day. Even better, the<br />

GCC compiler also runs on a variety of operating systems, such as Windows<br />

and Linux, so if you write a program using the GCC compiler, you can recompile<br />

your program to run under another operating system with minimal<br />

(hopefully) changes.<br />

The GCC compiler actually consists of two parts:<br />

✦ The front-end of the compiler translates source code into an intermediate<br />

<strong>for</strong>mat.<br />

• To write C++ programs, you must use the C++ front-end of the GCC<br />

compiler.<br />

• To write Ada programs, use the Ada front-end of the GCC compiler.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!