Stefan said:
Yes, but for C programming memory management is not an
irrelevant detail.
If the author would have wanted to focus on how to do
it /without manual memory management/ he could have chosen
a language with a garbage collector, like Java, or - if it
had to be C-like - a C-like language with a garbage collector,
like C with the Boehm collector. But he had chosen to use C.
This is silly. The author provided examples to illustrate concepts. In order
to better communicate concepts it is better to focus on the meaningful details
instead of wasting time with secondary, irrelevant aspects which is safe to
assume that all potential readers are already very familiar with.
Moreover, if an author opts to present concepts through pseudo-code instead of C
code then his work will not be less valuable and even the author would not be
more open to criticism. Therefore, if using purely abstract languages is not a
sin nor a sign of incompetence then why should anyone complain that an author
used a real-world programming language while leaving out irrelevant and
secondary details?
Taking the possibility of a 0 result of malloc into account
is not what I deem to be a »sanity« test ...
Is that even relevant, particularly in this discussion?
... nor irrelevant for C programing.
I believe you don't quite get it. Let's put it in this way: if a C programmer
picks up a book entitled "Advanced data structures" and he doesn't find a single
validation on calls to malloc(), do you believe that the absence of those tests
will hinder his ability to learn any topic covered in that book? And do you
believe that the problem would also be there if the book's examples were in
pseudo-code instead of C?
And then the author /does not even discuss/ this problem.
Why should he? That's terribly basic stuff. It's usually covered extensively
right at the beginning of any introductory course. Why should the author waste
time with topics which clearly should be a prerequisite to pick up the book?
Should the author also waste time discussing some intricacies of using the
english language to communicate with the reader?
It would not have been such a bad book, if he would have first
explained how to do proper memory management in C and then why
he will not use this in the rest of the book.
It's impressive how you are quick to label a book as being bad just because the
author chose to leave out such basic stuff, and therefore irrelevant and
meaningless due to the book's topic, out of it.
But he did not
mention this. Which gives the impression that he might not even be
aware of it.
If the author doesn't mention computers will that give you the impression that
he might not even be aware they exist?
I agree that the author of "Advance Data Structures" should
have read a book on basic C programming.
It appears that you are far too keen to quickly accuse someone as being
incompetent.
Rui Maciel