Expert C Programming

(Jeff_L) #1

Write a Palindrome


Claim your 15 minutes of fame: write a C program to generate that 10,000-word
palindrome. Really make yourself famous by posting it to rec.arts.startrek.misc on Usenet.
They're fed up with discussing Captain Kirk's middle name, and they love to hear about new
diversions.


Chapter 5. Thinking of Linking


As the Pall Mall Gazette described on March 11, 1889 "Mr Thomas Edison has been up on the two
previous nights discovering 'a bug' in his phonograph."


—Thomas Edison discovers bugs, 1878


The pioneering Harvard Mark II computer system had a logbook which is now in the National
Museum of American History at the Smithsonian. The logbook entry for September 9, 1947 has, taped
onto the page, the remains of an insect that fluttered into a switch and got trapped. The label reads
"Relay #70 Panel F (moth) in relay." Under this is written "First actual case of bug being found."


—Grace Hopper discovers bugs, 1947


As soon as we started programming, we found to our surprise that it wasn't as easy to get programs
right as we had thought. Debugging had to be discovered. I can remember the exact instant when I
realized that a large part of my life from then on was going to be spent in finding mistakes in my own
programs.


—Maurice Wilkes discovers bugs, 1949


Program testing can be used to show the presence of bugs but never to show their absence.


—Edsger W. Dijkstra discovers bugs, 1972


linking, libraries, and loading...where the linker is in the phases of compilation...the benefits of
dynamic linking...five special secrets of linking with libraries... watch out for interpositioning...don't
use these names for your identifiers...generating linker report files...some light relief—look who's
talking: challenging the Turing test


Libraries, Linking, and Loading


Let's start with a review of linker basics: The compiler creates an output file containing relocatable
objects. These objects are the data and machine instructions corresponding to the source programs.
This chapter uses the sophisticated form of linking found on all SVR4 systems as its example.


Where the Linker Is in the Phases of Compilation


Most compilers are not one giant program. They usually consist of up to half-a-dozen smaller
programs, invoked by a control program called a "compiler driver." Some pieces that can be
conveniently split out into individual programs are: the preprocessor, the syntactic and semantic
checker, the code generator, the assembler, the optimizer, the linker, and, of course, a driver program

Free download pdf