Sams Teach Yourself C++ in 21 Days

(singke) #1
Getting Started 13

1


The ANSI standard is an attempt to ensure that C++ is portable—ensuring, for example,
that ANSI-standard-compliant code you write for Microsoft’s compiler will compile
without errors using a compiler from any other vendor. Further, because the code in this
book is ANSI compliant, it should compile without errors on a Macintosh, a Windows
box, or an Alpha.
For most students of C++, the ANSI standard is invisible. The most recent version of the
standard is ISO/IEC 14882-2003. The previous version, ISO/IEC 14882-1998, was stable
and all the major manufacturers support it. All of the code in this edition of this book has
been compared to the standard to ensure that it is compliant.
Keep in mind that not all compilers are fully compliant with the standard. In addition,
some areas of the standard have been left open to the compiler vendor, which cannot be
trusted to compile or operate in the same fashion when compiled with various brands of
compilers.

Because the Managed Extensions to C++ only apply to the .NET platform
and are not ANSI standard, they are not covered in this book.

NOTE


Preparing to Program ............................................................................................


C++, perhaps more than other languages, demands that the programmer design the pro-
gram before writing it. Trivial problems, such as the ones discussed in the first few days
of this book, don’t require much design. Complex problems, however, such as the ones
professional programmers are challenged with every day, do require design, and the more
thorough the design, the more likely it is that the program will solve the problems it is
designed to solve, on time and on budget. A good design also makes for a program that
is relatively bug-free and easy to maintain. It has been estimated that fully 90 percent of
the cost of software is the combined cost of debugging and maintenance. To the extent
that good design can reduce those costs, it can have a significant impact on the bottom-
line cost of the project.
The first question you need to ask when preparing to design any program is, “What is the
problem I’m trying to solve?” Every program should have a clear, well-articulated goal,
and you’ll find that even the simplest programs in this book do so.
The second question every good programmer asks is, “Can this be accomplished without
resorting to writing custom software?” Reusing an old program, using pen and paper,
or buying software off the shelf is often a better solution to a problem than writing
Free download pdf