Programming and Graphics

(Kiana) #1

18 Introduction to C++ Programming and Graphics


a compiler and an assembler is that the former understands logical structures,
whereas the latter performs a blind translation.


Thirdly, we link the object codes with other installed or system binary
libraries called by the program, thereby producing theexecutable. Library
files may contain mathematical functions, graphical tools, and graphical user
interfaces that allow a program to run in its own exclusive space on the computer
desktop. Some compilers have their own linkers, other compilers use linkers that
are provided by the operating system.


Finally, we load the executable code into the memory and thereby launch
the executable; the presence of the compiler is not necessary. Since different
CPUs have different machine languages, an executable produced on one CPU
will not necessarily run on another. Moreover, the object files are not necessarily
portable across different versions of an operating system on the same hardware
platform.


Some language compilers producebytecode, which is portable across a
variety of platforms. The bytecode is further compiled to produce machine
code, or else executed directly through an interpreter.


While these are the general rules, there are exceptions. A program written
in the standard version of theBasiclanguage or inMatlabis compiled, or,
more accurately, interpreted line-by-line as it runs. The presence of the compiler
or interpreter is thus necessary for the program to run. A buggy interpreted
code may run until failure, whereas a buggy compiled code will not compile.
Executable codes run much faster than interpreted programs.


Data files


Numerical and other parameters are either contained in separate files,
called data or configuration files, or are entered from the keyboard as the pro-
gram runs. Data files are usually denoted with the suffix.dat, and configuration
files are usually denoted with the suffix.conf.


Problems


1.5.1.Conduct an Internet search to prepare a list of ten computer languages.


1.5.2.An executable was generated using an operating systems with a particu-
lar CPU. Is it possible that this executable may also run under a different
operating system on the same CPU?

Free download pdf