code quality dds
FAQ
A list of comments marking code parts of dubious quality.
You can read the full list of such comments appearing in the book's CD-ROM
here.
If N == 5.8
this is your lucky day:
you can find an answer here.
Otherwise, read on.
Most exercises are quite open-ended and do not have one correct answer.
Besides, the objective of the exercises it to do them on your own.
Please first have a look on the errata page to see
if this is a known and documented error.
If it isn't, you might have found a new one.
Please drop me a line with a short description of the error,
the page number, and the book's printing number
(shown on the bottom of the fourth page).
If this is an error in the text I wrote, I will probably add it in the
errata page with a reference to your name (unless you ask for your contribution
to remain anonynous).
Errors in the open source code examples also interest me, but do not go
in the errata page; I might include a note in a subsequent edition.
The
GNU General Public License
is associated with the code's copyright.
Copyright protects the expression of an idea, not the idea itsself.
Thus, using a variable name appearing in GPLed code one has read could
be problematic, but adopting a design used in GPLed code in new
code one creates should be ok.
In addition,
none of the code appearing in the book is GPLed. I have used code licensed
under BSD and similar licenses,
to avoid problems with intepreting the GPL and its requirements.
Disclaimer: I am not a lawyer, and this is not legal advice.
The error
function will fail on an architecture where the size of pointers is
larger than the size of integers, when a pointer with a value that
can't fit into an integer is passed to it.
The value will get truncated to the size of the integer,
and the error
function will operate on a different pointer.
As an example,
the following program will crash on an Alpha processor under FreeBSD 5.5
error(fmt, a, b, c, d, e, f, g)
char *fmt;
{
printf(fmt, a, b, c, d, e, f, g);
}
main()
{
char *s = "world";
error("Hello %s\n", s);
}
On an AMD-64 with Linux the error is more devious.
The program will work as long as the allocated
data size is less than 4GB.
When pointers exceed that value (as in the following example)
the program will crash.
#include <stdlib.h>
error(fmt, a, b, c, d, e, f, g)
char *fmt;
{
printf(fmt, a, b, c, d, e, f, g);
}
main()
{
char *p = malloc(4l * 1024 * 1024 * 1024);
char *s = malloc(4l * 1024 * 1024 * 1024);
strcpy(s, "world");
error("Hello %s\n", s);
}
The C99 standard in section F.9.4.4 states: pow(-1, ±∞) returns 1.
Some older versions of glibc did indeed return NaN, but this error has now been
fixed.
See my personal FAQ list, and if that fails
to answer your question
send me an email with a concise description of
your question.
Keep in mind that I receive more than a hundred messages every day,
so I may take some time to answer to your message.
Book homepage | Author homepage
Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.
Last modified: 2006-07-24