Читать книгу Beginning Programming All-in-One For Dummies - Wallace Wang - Страница 81

Choosing a Compiler

Оглавление

No two compilers work exactly the same, even compilers designed for the same language, such as two competing C++ compilers. It’s perfectly possible (and quite common) to write a program that works perfectly with one compiler but doesn’t run at all under another compiler without minor (or massive) changes.

When Microsoft wrote the Mac version of its Microsoft Office suite, it used CodeWarrior, which is a C++ compiler. Unfortunately, the CodeWarrior compiler ran only on the PowerPC processors, which were used in older Mac computers. When Apple switched to Intel processors, Microsoft had to dump the CodeWarrior compiler and use a different compiler called Xcode.

Because CodeWarrior and Xcode are both C++ compilers, Microsoft could theoretically compile the same C++ program under both CodeWarrior and Xcode with no problems. Realistically, Microsoft had to rewrite major portions of their C++ programs just to get them to run under the Xcode compiler. The moral of the story is that switching compilers is rarely an easy decision, so it’s important to choose the “right” compiler from the start.

At one time, the CodeWarrior compiler was considered the “right” compiler to use for creating Mac programs. What made CodeWarrior suddenly turn into the “wrong” compiler was when Apple switched from PowerPC processors to Intel processors. Everyone who had used the CodeWarrior compiler had to switch to the Xcode compiler. Bottom line: What may seem like the “right” compiler today could later turn out to be the “wrong” compiler through no fault of your own or the compiler company.

When choosing a compiler, you have to consider your needs, the compiler company’s reputation, and the compiler’s technical features.

Beginning Programming All-in-One For Dummies

Подняться наверх