D Unleashed - The Blooper List


Chapter 7 - When Things Go Wrong: Code Mending



Type Page Error Correction Reported By
Technical 209 -O2 and -o switches missing Change to 'gcc -W -Wall -ansi -pedantic -O2 -o foo foo.c'
Typographical 213 near bottom of page: 'full of gotos' monospace font required: 'full of gotos'
Typographical 217 '100' 'a hundred'
Typographical 219 '%' should be in monospace font.
Technical 221 Two of the three occurrences of strcat in the penultimate paragraph are wrong. Should be Name (wow, that must have been a 3am job!)
Typographical 222 Last paragraph - 'signed' and 'unsigned' Should be in monospace font.
Technical 226 '%d' Should be '%lu'
Typographical 227 'not' should be in italics
Typographical 231 Listing 7.6 - spurious line: header file (trace macros)> Remove the line. This is a typo, not a techie error, because I checked the CD code and it's fine. :-) Dave Vandervies
Technical 237 Listing 7.7 - That dreadful code for getting a filename is flawed - the modulo ops should be divisions (for DaysSince1999 and YearsSince1999), which means that the surrounding if statements can be removed. How I wish I'd written that code in the year 2000 - it would have been so much cleaner! Change mods to divs, and remove surrounding conditionals. Dave Vandervies
Dire writing style! 240 'The oddity here is that we need two sets of parentheses, which does look a little odd.' Change 'odd' to 'weird' :-)
Explanatory Note 243 In the sidebar, I didn't make it very clear why my code failed to compile. What happened was this: The project was built using a DEBUG flag which was set in the compiler options in the JCL (you know the kind of thing: -DDEBUG=1). At one point in my code, I did a little debug-only calculation just to check that something important had been done correctly. For this, I needed a variable. Since it wasn't a "production" variable, I enclosed its definition in #if DEBUG/#endif. I then used the value of the variable in an assert() statement - that was the whole point of the exercise, in fact. Now, the guys responsible for building the release version of the code did so simply by removing the -DDEBUG=1 bit from the JCL. Thus, my assertion didn't compile (because it was suddenly using an undefined variable). But of course the assertion shouldn't have been compiled at all, and would not have been, had the JCL guys defined -DNDEBUG=1 as they should have done. Partly my fault for not making the variable dependent on !NDEBUG rather than DEBUG, partly their fault for not defining NDEBUG, and partly the fault of whoever decided to use a non-standard debug macro. There - I think I've managed to spread the blame fairly evenly now... :-)
Typographical 244 four thousand million 4,000,000,000
Typographical 248 Sidebar: 'gdb' should be in monospace font.
Confusing non sequitur 249-250 Sidebar "The Jargon File" appears to be a non sequitur Swapping the entire sidebar with following paragraph (i.e. move paragraph starting 'The Jargon File contains four...' above sidebar) will clarify matters.
Typographical 252 Paragraph beginning 'So what can we do...' has wrong font for 'ints' Should be ints




Back to index