15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

88<br />

Choosing a Compiler<br />

✦ The speed of a compiler can refer to the per<strong>for</strong>mance of the machine<br />

language code that the compiler creates.<br />

Given the same program, one compiler may create a program that runs<br />

quickly whereas a second compiler may create that same program that<br />

runs much slower.<br />

Ideally, you want a compiler that both compiles fast and creates programs<br />

that run fast.<br />

Target plat<strong>for</strong>ms<br />

Most compilers can compile programs only <strong>for</strong> a specific operating system,<br />

such as Windows or Linux. However, what happens if you need to write a<br />

program that runs on two or more operating systems?<br />

You could write the program twice with two different compilers — one <strong>for</strong><br />

each operating system. So if you wanted to write a C++ program that runs<br />

under Windows and Mac OS X, you could compile that program by using<br />

Microsoft Visual C++ (<strong>for</strong> Windows) and then write a similar program to compile<br />

by using Xcode (<strong>for</strong> Mac OS X).<br />

Of course, writing the same program two times <strong>for</strong> two different compilers on<br />

separate operating systems is a tremendous waste of time. As an alternative,<br />

some compilers are known as cross-compilers — they can create programs that<br />

work on multiple operating systems, such as Windows, Linux, and Mac OS X.<br />

Figure 4-2 shows the REALbasic cross-compiler, which lets you choose whether<br />

to compile a program <strong>for</strong> Windows, Linux, or Mac OS X.<br />

Figure 4-2:<br />

A crosscompiler<br />

lets you<br />

write a<br />

program<br />

and<br />

compile it<br />

<strong>for</strong> multiple<br />

operating<br />

systems at<br />

the click of<br />

a mouse.

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

Saved successfully!

Ooh no, something went wrong!