C the complete nonsense

S

spinoza1111

spinoza1111 wrote:

Based on finding 6 errors and inflating them to only 20,
you've made an absurd generalization.

Random quote from CTCR 2nd edition. This one is from p154:

"The argc parameter holds the number of arguments on the command line
and is an integer. It is always at least 1 because the name of the
program qualifies as the first argument."

This is wrong. It is perfectly legal for argc to be 0 and argv[argc] to
be a null pointer, and it's not even terribly difficult to do.

Prints one with a command line with no arguments BEYOND the name of
the command:

#include "stdio.h"
int main(int argc, char *argv)
{
printf("%d\n", argc);
}

Prints "0 0":

#include "stdio.h"
int main(int argc, char *argv)
{
argc = 0;
argv = 0;
printf("%d %d\n", argc, argv);
}

Sure, it's easy (especially, apparently, for you and Peter) to mess
up, but working programmers as opposed to corporate drones and casual
workers with too much time on their hands need to know the normed
case, which is that argc is going to be one when there are no
arguments other than the name of the command. This is because C, as
elsewhere, is a bit messed up in counting arguments, and includes the
name of the module. This is in turn because C was designed for
programming a command line interface which is pretty much out of date.

K & R were showing off their knowledge that zero is a number, and
admittedly, IBM in the 1960s and in Fortran had obscured this fact by
one-origin indexing. This was refreshing and enlightening at the time
but it's been FORTY YEARS since then, and today thinking of computing
as a series of commands on a Teletype is an absurd model.

You are as usual maliciously lying and will face the man in the grey
wig if you keep it up.
Since we're on that page anyway, here are two more errors, this time to
do with argv:

"The argv parameter is a pointer to an array of character pointers. Each
element in this array points to a command line argument."

Firstly, it's actually a pointer to *the first element of* an array of
character pointers. Terminology is especially important in a tutorial!

Utterly absurd. Will you PLEASE just crawl back to whatever rock you
crawled out of? In ordinary metalanguage, the first position
represents the array as a whole.
Secondly, argv[argc] is an element in the array which does not point to
a command line argument.

Oh gee you're so smart, aren't you. Heathfield, stop grandstanding;
you look like a fool.
 
S

spinoza1111

Keith Thompson said:
Malcolm McLean <[email protected]> writes:

[SNIP - countering PS's C:TCN]
As long as I'm posting I'll mention that
    The "heap" is a DOS term...
is a perfectly correct statement.  It doesn't necessarily imply
that it's *only* a DOS term.  It also happens to be a Unix term,
and a Windows term, and a Symbian term, and so forth (and yes,
an updated version of the web page should probably clarify that).
The point is that it isn't a C term.

When I first learnt C, it was being called the "free store" or

Incorrect use of the participle "learnt" for the past tense of to
learn.
something so similar my memory cannot distinguish it. Given that
the 'heap' isn't structurally or algorithmically a 'heap', I always
wondered why a less baggage-laden term wasn't more popular.

Actually, the primitive structure Herb was talking about is indeed a
"heap" in an abstract sense and in contrast to the stack. The stack
contains small and fixed length values. When a value (a struct or
array) doesn't fit, we use an address in a free store. OO practice was
based on this.

I first saw the usage of "heap" in Saul Rosen's 1968 collection of
papers on early software. A computer scientist who actually programs
narrates what she's doing in ways that may seem to uneducated mere
programmers as incorrect, but I prefer her definitions.

Scientists know what a word means. Little technicians rely on
"terminology".
 
S

spinoza1111

I think that's shooting fish in a barrel territory.


And also a bit of concern about why he would jump in and make silly
claims ("it's a tutorial, not a reference" -- HUH?!).

Don't start in on Malcolm, please. You've done enough damage.
Yes.  The commentary can only be evaluated in terms of the thing commented
on.

Wrong. The commentary is absurd.
I think there's certainly a meaningful sense in which it's not a
"proper critique"; if I went to someone for a professional-quality
book review, and got back C:TCN, I'd be upset.

But as things posted on the internet for free roughly 15 years ago go,
it's not bad.


Well, yes.  The purpose of this whole thing seems to be that the Wikipedia
admins chose to accept the C:TCN page as sufficient evidence that the
"controversy" section deserved to be there.  Thus, if Nilges can get enough
people to argue that C:TCN isn't a very good critique...  nothing happens.

Because the underlying point isn't anything to do with C:TCN.  It's that

It has everything to do with CTCN.
the page is an *example* of the general category of "reputable C experts who

You are not a reputable C expert.

You have not published on C (please respond if you can with articles
on C only that I have missed).

You have shown yourself to be an incompetent C coder who fails to
write structured code and makes newbie errors in the last three
months.

Your only known confederates are Clive Feather, a nasty piece of work,
and Richard Heathfield, a nasty piece of work.

You have zero experience in the use of C outside of unix.
have served on the committee pan Schildt's work".  Clive's commentary would

You paid your way in. I believe you did so as resume padding. You have
admitted padding your online resume to make it appear that you have
worked for Apple Computer since 1987 and are a venture capitalist for
them.
do just as well.  For that matter, even if C:TCN went away, it wouldn't
change the fact that I'm quite clearly on the record as stating that the
book is junk that I would never inflict on someone trying to learn C.

Yes, but nobody would care.
If people really care, hey, I can always do a proper critique.  I've got
another ~15 years of writing and programming experience to draw on since
the days when I wrote C:TCN.  That said...

If I were to write such a page today, based on the 4th edition, it would have
fewer nitpicking errors, but I could do a much better job of explaining in
detail, and presenting effectively, the case that the remaining errors both
conceptual and technical are serious enough to utterly dispel any notion
that the book ought to be used to learn from.  I know a lot more about
writing, and about how to teach people about computers, and about C, than I
did back in ~1995 or so.  My impressions of Schildt's work have not changed
for the better.

Nobody would trust you. I think Ben should do this. And I believe he
would discover that he needs to learn more about Microsoft to do a job
according to his high standards, and would give up halfway through.
 
C

Colonel Harlan Sanders

Very good. We're making progress. OK, you have write access to the
post. I will drop the matter if you replace it by a blank post, or
something saying "withdrawn". You do not need to apologize therein to
Herb, you do not need to apologize for the damage you've done to me,
and you do not need to notify me of your action.

I do not accept arguments of this form. "My classmates are stupid
therefore I am smart" is not a valid inference. Furthermore, viral
replication of the claims, scattered over many different sites, is the
problem.

I think he's apologising for not demolishing CTCR more thoroughly. Not
for doing so incorrectly.

-- You seem to really believe that Seebs wrote a web page 15 years
ago, then used his Jedi power to hypnotise the world into believing
it. And that you can break this spell by bullying, threatening and
screaming at him to delete the page.
If you would just blank the site, I can then go into wikipedia as an
anonymous ip address and quite properly remove the section of the
article on Schildt that continues to damage his reputation.

And it will be reverted a few minutes later, as the last 500 times you
tried to do this.

Because, even if you did manage to get rid of Seebs' page (which I'd
lay loooong odds against), the statements you are so het up about are
supported by other sources:

from http://en.wikipedia.org/wiki/Herbert_Schildt
Reception

Schildt's books have a reputation for being written in
a clear style that is very easy to understand.[1]
However, their technical accuracy has been criticized.
Peter Seebach, a former voting member of ISO C
committee and moderator of the Usenet group
comp.lang.c.moderated, alleges that Schildt's C: The
Complete Reference contains code with beginner's
mistakes and statements suggesting the wrong idea.[1]
Schildt's The Annotated ANSI C Standard was similarly
criticized by Clive Feather, who is also an ISO C
committee member, and by Steve Summit, author of the C
FAQ.[2][3]

So before you can think about censoring this section you would have to
target Feather and Summit and get them to amend their critiques.
Ain't going to happen. Feather made his opinions clear some months ago
when you started this insane crusade.

By the way, the current threads you are generating here are producing
more support to the "Schildt is crap" side of the argument.

If anyone feels inclined to compile relevant posts into a webpage
these can be cited more readily than Usenet posts and can be added to
the References section of the wiki page.


By the way,

I will stop posting and reading until Sunday 11 April China time.

Another bare-faced lie, a promise broken less than two days later.
You will go ballistic if anyone questions your word, yet over and over
you demonstrate it is worth nothing.
 
J

James Harris

....


Very good. We're making progress. OK, you have write access to the
post. I will drop the matter if you replace it by a blank post, or
something saying "withdrawn". You do not need to apologize therein to
Herb, you do not need to apologize for the damage you've done to me,
and you do not need to notify me of your action.
....

If you would just blank the site, I can then go into wikipedia as an
anonymous ip address and quite properly remove the section of the
article on Schildt that continues to damage his reputation.

Weren't you "banned" from Wikipedia for making inappropriate edits
including under anonymous IP addresses?

Please don't even consider removing what you call "the section of the
article on Schildt that continues to damage his reputation." Apart
from Peter Seebach's comments the "section" refers to two other
sources of criticism. Even if Peter does what you request - and I hope
he does not - that would be no mandate for you to remove references to
other criticism.

....
You can do that, of course. However, to do an acceptable job, you need
to provide all of what you think are errors, and you have to be
prepared to have to defend your document. It appears to me that you do
not have enough academic experience in this type of interchange to
know how time-consuming this would be for you. I think it would be
better for you to return to school and learn the trade you profess.

An update to Peter's criticism would be beneficial. As he himself
recognises there are ways it could be improved such as by removing
nitpicking errors. Time has moved on but for a 15-year old document
it's not bad.

If you are an academic, Edward, you should recognise the value of
assertion and criticism. The presence of both serves to produce a
better-informed readership. Notwithstanding my view that the critical
page of Peter's would benefit from an update, ISTM that the Wikipedia
article is balanced as it stands. I don't understand what's motivating
your desire to change it.

James
 
S

spinoza1111

On Apr 5, 5:48 am, Keith Thompson <[email protected]> wrote:

.... snip snip snippy snip: you nasty little clerks are right as you
often are, on something trivial: I need to snippety snip more ...

However, a literate person knows how to disambiguate "is", as do
literate OO programmers, who use "is-a" to show subset in inheritance
as opposed to "has-a" to show reference to an object, and "==" in C
Sharp in Java to show identity.

Error: change in to or.

Snip snip snippety snip
I need to get wise, and I need to get hip,
And follow the trivial rules
That have lighted fools
The way to dusty death
Sorta like Macbeth.

You know the old play.
Glamis, then Cawdor, then the buttered Scone:
But what's little noticed and lesser known,
Is Macbeth's foolish logic...he's brainsick.
I mean, those bitches on the heath-field
Crones that call to Richard in his lonely room,
Prophesied he should be Cawdor, and he wuz:
So what does the kilted Jocko do?
He kilts Duncan like a scuz!

This sort of subhumanity
We see here, and it's a tragedy:
For 6 errata don't make your case
Any more than you prove jackshit when a mess you makes
Out of argc
And also argv.

Macbeth wanted the throne, to sit his arse upon the throne,
Before he met Heathfield's grannies and aunties in th' gloam.
Likewise Seebach plucks at prophesies and dreams
To pretend he's competent, and at night he screams.
 
S

spinoza1111

The text content of the cover is part of the galleys sent
to the author for fact checking and approval.

That is correct: Apress did that for me. However, in many situations,
it's too much "time" (especially in a larger company than Apress, like
McGraw Hill) to make the change on deadline.
 
J

James Harris

....


You are not a reputable C expert.

You have not published on C (please respond if you can with articles
on C only that I have missed).

You have shown yourself to be an incompetent C coder who fails to
write structured code and makes newbie errors in the last three
months.

Your only known confederates are Clive Feather, a nasty piece of work,
and Richard Heathfield, a nasty piece of work.

"A nasty piece of work"! Is this one of those irregular definitions
such as

"I am forthright"
"You are abusive"
"He is a nasty piece of work"

Or is it a term which you use for those who disagree with you.
Perhaps: for those who disagree with you and for whom you are running
out of arguments to counter.

I've noticed that Richard has been making comments on the issues with
pieces of code in an edition of the book. And thanks to you bringing
the matter up in this thread some minor and some fairly serious
criticisms have been levelled at Schildt's work. The main problem with
your argument, ISTM, is that you haven't made an effective defence of
his code.

In fact you seem to focus on personal attacks on others. By doing so I
would say that you are showing yourself to be "a nasty piece of
work." (My definition, this time.)
You have zero experience in the use of C outside of unix.

Are you unable to see that, even if true, this is irrelevant? If
something is misleading it is misleading no matter who says so.
Continually attacking or challenging where people come from is
immaterial if the points they are maing are valid.

If the points are wrong then say so, and say why. To waffle on about
who people knew or what their background is is irrelevant when the
issues are plain, unambiguous and open to discussion which is the case
here.

James
 
S

spinoza1111

Weren't you "banned" from Wikipedia for making inappropriate edits
including under anonymous IP addresses?

That's correct. And you can find a full discussion of this between
myself and someone who at least appears to be Jimmy Wales, wikipedia's
founder, at http://spinoza1111.wordpress.com/2010/01/06/wikipedias-racist-bullying-redux/.

The fact is that in 2006, wikipedia drove out educated contributors
and replaced them by convenience store clerk types who applied rules
without subject matter knowledge. This is well known and is confirmed
by many former contributors.

In my case I was with the encouragement of the informal moderator of
changes to the Kant page (a uni prof) making contributions, but my
experience in teaching philosophy in various capacities since 1973 is
that to TEACH philosophy you must DO philosophy. This bothered
somebody called amerindianarts and he started edit warring my changes.

I was like, kemosabe, up yours because I don't suffer fools gladly.
However, today's techno-peasants (cf. Jaron Lanier, You Are Not a
Gadget) are taught to grin and shuffle, so I was tagged as a bad
nigra.

Several bigshots, perhaps Wales, would like me to come back little
Sheba in order to get free content. Unfortunately I make my living at
teaching among other things philosophy, so why be a cow when the milk
is free (or something like that). Wales et al. want me to subject
myself to a Stalinist show trial in which I like Bukharin humbly admit
my failings. Which I sure won't.

It is also said that I was "banned" from a local placeblog. What
happened was that (1) I was made a moderator by the big cheese. (2)
Other moderators, disturbed by my literacy and the fact that based on
original graphics I posted, I became "artist of the month" with a one
man show in a local gallery, started disrupting "my" group. (3) I
invited them to perform an aerial reproductive maneuver. (4) My
privileges were reduced by the big cheese. (5) I left since this was a
waste of time.
Please don't even consider removing what you call "the section of the
article on Schildt that continues to damage his reputation." Apart
from Peter Seebach's comments the "section" refers to two other
sources of criticism. Even if Peter does what you request - and I hope
he does not - that would be no mandate for you to remove references to
other criticism.

Excuse me, don't bore me with things I already know. The fact is that
before January of last year, the Schildt article, which was created to
trash the guy, was in serious violation of Biographies of Living
Persons, wikipedia's own policy. I changed it as a "blocked" user and
that change has been effective ever since. If Peter simply blanks CTCN
I can go back and get the Reception section changed.

The Reception section mischaracterises Seebach as "a former voting
member of ISO C committee and moderator of the Usenet group
comp.lang.c.moderated". The fact is, as he has himself confirmed, he
paid his way onto the ISO committee and as a moderator, he does no
work, allowing all posts through. But if we can get CTCN removed from
the Internet, this will make our case for the removal of the Reception
section.

It's not really appropriate that Schildt has a wikipedia biography in
the first place, since being a hard working computer author and
musician is not by itself significant enough. Dan Appleman has
published extensively on programming, is one of the nicest guys I'd
care to know, was slashdotted, and is currently a technology columnist
for the San Francisco Chronicle, but does not merit a wikipedia
biography. The Schildt biography was created, and sourced solely on
Seebach's attack on CTCR (and Feather's attack on C: the Annotated
Standard, a copycat crime), in order to pad the anti-Schildt "case".

Nobody's going to create a wikipedia article about me despite the fact
that I'm a hard working author and teacher and a good looking, sexy
guy, unless they wish to immortalize "Nilgewater" as a term of art;
but this was tried, I complained, and the entry disappeared into thin
air.

Private people who work hard, whether Schildt, Kathy Sierra, or Kim
Pring (a Miss Utah lampooned in Hustler) have a right under the UN
Declaration of Human Rights and the Ninth Amendment to the US
Constitution insofar as the latter applies to PRIVACY. As it is, even
defending them as I do (I got the Sierra article repaired as well as a
"blocked" user) can cause them further anxiety. That is why I am
asking Peter Seebach to be a man for a change, and blank CTCN. This
matter will end.
...



An update to Peter's criticism would be beneficial. As he himself
recognises there are ways it could be improved such as by removing
nitpicking errors. Time has moved on but for a 15-year old document
it's not bad.

If you are an academic, Edward, you should recognise the value of
assertion and criticism.

I am only an adjunct and free market academic. However, I have I think
a better sense of what "criticism" really is, based on teaching
logic.

It isn't inferring from finding 6 errata to a global charge that you
know will be replicated and amplified on the internet in the fallacy
of composition.
The presence of both serves to produce a
better-informed readership. Notwithstanding my view that the critical
page of Peter's would benefit from an update, ISTM that the Wikipedia
article is balanced as it stands. I don't understand what's motivating
your desire to change it.

Such a Reception section could be made of most computer authors. Many
C programmers hate K & R. Shouldn't we give them a section in the
article on Kernighan? A coworker laughed at the title of The Art of
Computer Programming, since, he said, it's not an art. Shouldn't
ignorant people have a section in the Knuth article?

OF COURSE NOT, because Wikipedia's own Biographies of Living Persons
policy forbids gratuitous assaults on both people who are (in the
distinction made by the US Supreme Court in the case of Flynt v
Robertson) "public figures" and "private figures", with a higher, not
a lesser, standard for private figures.

The Wyoming lawyer Gerry Spence in fact lost a case in which he
defended a Utah beauty queen who was lampooned as giving blow jobs in
Hustler. I feel, however, his reasoning in this case was sound: it was
that private people who are for a temporary and special reason in the
public eye do not thereby become true public figures. A beauty queen
looks better in a bikini than I do as a computer author, but we're
both essentially private figures who for that reason deserve a higher
standard of care.

This is because mere employability is more important to most private
individuals, and these gratuitous "mean kids" attacks on Kim Pring,
Kathy Sierra, et al. harm their standing in their community and that
of their family members.
 
T

Tim Streater

Richard Heathfield said:
Richard said:
[...] The fact is, as he [Seebs] has himself confirmed, he
paid his way onto the ISO committee [...]

So did Schildt.

So did every member of the ISO C Committee, as far as I am aware. It's a
bit like getting on the train - you're supposed to have a ticket first.

Indeed.

Ad hominem attacks are all that Spinny has left. He keeps being trumped
by the facts and tries to squirm out of it each time.
 
M

Malcolm McLean

And also a bit of concern about why he would jump in and make silly
claims ("it's a tutorial, not a reference" -- HUH?!).
I haven't actually read the book. However that's the impression I
gain. I think that "the book tries to be both a tutorial and a
reference" might be a valid criticism. But you don't actually make
that criticism.
Yes.  The commentary can only be evaluated in terms of the thing commented
on.
Whilst there are some things we cannot tell, for instance if you
happened to misquote Schildt there would be no way of knowing about it
without going to the original, you can tell whether a commentary is
trying to be balanced or not, or whether some of the points it makes
are fair, without actually seeing the original. Which is what I've
done.
I think there's certainly a meaningful sense in which it's not a
"proper critique"; if I went to someone for a professional-quality
book review, and got back C:TCN, I'd be upset.
You said it. It's very unprofessional to make bug reports in a
sneering tone, so "C: the complete nonsense" is no good as an errata
page. However it's not a review. Slamming reviews are acceptable, but
they can't consist entirely or mainly of nitpicks, especially when the
book is over 700 pages long. When half of the nitpicks aren't even
right, the credibiility of the critique goes down even further.
However "C: the complete nonsense is a bad webpage" isn't the
same as "C: the complete reference is a good book". It is possible to
make a bad criticism of a bad book.
 
W

Walter Banks

Richard said:
Richard said:
[...] The fact is, as he [Seebs] has himself confirmed, he
paid his way onto the ISO committee [...]

So did Schildt.

So did every member of the ISO C Committee, as far as I am aware. It's a
bit like getting on the train - you're supposed to have a ticket first.

Indeed.

It is splitting hairs but any fees maybe paid are to national standards
groups who are responsible for sending representatives to ISO meetings.
Fees are not normally paid by individuals to ISO. In the US this is ANSI
which has a fee structure for individuals. In Canada the Canadian Stanadards
Association is our link to ISO.


Walter Banks
 
W

Walter Banks

spinoza1111 said:
That is correct: Apress did that for me. However, in many situations,
it's too much "time" (especially in a larger company than Apress, like
McGraw Hill) to make the change on deadline.

The "bigger companies" it is not a question of time but due diligence.
The author signs off on the galleys before the book goes to press. The
actual press time is not scheduled until that point.

This is why Schildt not his publisher is ultimatly responsible for the
content.

w..
 
S

spinoza1111

I haven't actually read the book. However that's the impression I
gain. I think that "the book tries to be both a tutorial and a
reference" might be a valid criticism. But you don't actually make
that criticism.

Yes, and for most readers, all editions but the fourth are
unavailable. Libraries deaccess old computer books and used book
dealers don't want them unless they are known classics on computer
science...not programming. This means that if Seebach doesn't at least
keep the page up to date, it is not a valid criticism and should not
be referenced in wikipedia.
Whilst there are some things we cannot tell, for instance if you
happened to misquote Schildt there would be no way of knowing about it
without going to the original, you can tell whether a commentary is


....and as above the original is unavailable to most checkers...
trying to be balanced or not, or whether some of the points it makes
are fair, without actually seeing the original. Which is what I've
done.

....as I have. Where Seebie seems to be right I have acknowledged it.
But there are only, as I have shown, six solid errata in CTCN. Not
enough to base his or anyone else's case.
You said it. It's very unprofessional to make bug reports in a

I quite agree.
sneering tone, so "C: the complete nonsense" is no good as an errata

Starting with its snarky title.
page. However it's not a review. Slamming reviews are acceptable, but
they can't consist entirely or mainly of nitpicks, especially when the
book is over 700 pages long. When half of the nitpicks aren't even
right, the credibiility of the critique goes down even further.
      However "C: the complete nonsense is a bad webpage" isn't the
same as "C: the complete reference is a good book". It is possible to
make a bad criticism of a bad book.

Quite so. In fact, Amazon contains thousands.

Peter: two distinguished people here, Dr. McClean and Navia, the
author of lcc as it exists today, have concurred in general with me.
Don't you think it's time to blank CTCN at a minimum?
 
S

spinoza1111

Phil Carmody wrote:

I've previously been utterly content that I have no copies of
any edition of this book, for obvious reasons. However, you
having turned it into a game have reversed that, and I have a
nasty feeling if I see one on the cheap, I'll not be able to
resist...

Oh, I'm sorry about that. But we have yet to turn it into a *drinking
game*, as Seebs originally suggested.

Let's play the game again:

Schildt's CTCR2e, p502:

Example

This function converts the number entered at the keyboard into its
absolute value:

#include "stdlib.h"

long int get_labs()
{
   char num[80];

   gets(num)

   return labs(atol(num));

}

Actually, of course, it does no such thing, because it won't compile.

Of course it won't. There is a missing semicolon at the end of gets. A
professional programmer sees this and fixes it without making absurd
generalizations about the computer author. Whereas incompetents like
to play the back-stabbing game.

Richard, this is a stupid game. Anyone's code snippets have any number
of preconditions, and no professional programmer cuts and pastes so
blindly. I realize that you're not a professional programmer, but
don't use your ignorance of your trade as an argument.

Furthermore, you're using an out of date edition.

For the last time, scumbag. Proving that your computer teachers were
mistaken about something, and proving that a computer author made
mistakes, does not make you competent or of service to others except
in a barbaric and fantasy logic. We have tools such as compiler
diagnostics for finding random errors. We expect from you
professionalism and decency, and you don't show it.
 
S

spinoza1111

<snipped>

This group has some very evil people in it, so here's a revised and
corrected copy of my Macbeth poem. Poetry can drive out evil spirits.

Snip snip snippety snip
I need to get wise, and I need to get hip,
And follow the trivial rules
That have lighted fools
The way to dusty death
Sorta like Macbeth.
You know the old play.
Glamis, then Cawdor, then the buttered Scone:
But what's little noticed and lesser known,
Is Macbeth's foolish logic...he's brainsick.
I mean, those bitches on the heath-field
Crones that call to Richard in his lonely room,
Prophesied that Macbeth should be Cawdor, and he wuz:
So what did the kilted Jocko do?
He kilted Duncan like a scuz!

This sort of subhumanity
We see here, and it's a tragedy:
For six errata do not make your case
Any more than you prove jackshit when a mess you makes
Out of argc
And also argv.

Macbeth wanted the throne, to sit his arse upon the Stone,
Before he met Heathfield's grannies and aunties in th' gloam.
Likewise Seebach plucks at prophecies and dreams
To pretend he's competent, and at night he screams.
 
S

Seebs

[Seebs - please read this, as I have a question for you at the end.]
*bamf*

"I had been given the mission of creating a complete reference guide to
the C programming language. Not just /any/ book, but the /complete/ book."
*snerk*

Okay, this is from page 420 of the second edition of CTCR, not a page I
recall seeing before.

Well! This is fortuitous.

The 2nd and 3rd edition are extremely similar in page numbering, and while
paging to it, I found my receipt.

I bought the 3rd edition on 1/22/96, specifically to write about it, so I
can now state that the page in question is just over 14 years old. 15 was
an estimate based on the book's copyright date.

It's now page 407, by the way.
This fragment reads up to 128 characters from the file described by fd:

unsigned count
char *buf[128];

if(_dos_read(fd, buf, 128, &count))
printf("error reading file");
Seebs: was this corrected in CTCR3?

No. But!

The error message was changed to "Error reading file."

So not only are the three obvious errors still there, but they are still
there despite the fact that, demonstrably, someone looked at the example.

I can't find any <dos.h> stuff in the 4th edition; it looks like it was
removed entirely. So, to add insult to injury, not only is it an extremely
buggy example with no explanation offered, but it was NEVER fixed -- at
least some of the errors were "fixed" by making a new edition in which
they are corrected.

Flipped around a bit, found a new example. 4th edition, page 264:

#define MAX_SIZE 100
/* ... */
float balance[MAX_SIZE];
/* ... */
for(i=0; i<MAX_SIZE; i++) printf("%f", balance);
/* ... */
for(i=0; i<MAX_SIZE; i++) x =+ balance;

The reader is encouraged to try to spot errors. I only found two; can
you do better?

(Note that the last line of the above example wasn't present in the 3rd
edition, where the example appears on page 262, but the other problem
existed then too.)

.... And dammit, looking it up, I found another one:

#include <stdio.h>
#define ABS(a) (a)<0 ? -(a) : (a)
void main(void)
{
printf("abs of -1 and 1: %d %d", ABS(-1), ABS(1));
}

When this program is compiled, a in the macro definition will be
substituted with the values -1 and 1. The parentheses that enclose
a ensure proper substitution in all cases.

Never mind the misdeclared main and the missing newline. Who here can
come up with a case where ABS(x) doesn't produce the expected result?

.... Nevermind, it's like shooting fish in a barrel.

printf("abs(3) - 1: %d\n", ABS(3) - 1);

The forth edition points out that the () around a are needed, and illustrates
that, without them, ABS(10-20) wouldn't produce the right results -- meaning
he reviewed this example again and still didn't spot the OBVIOUS BUG.

Seriously, guys, this book is MUCH WORSE than I claimed. I thank Mr. Nilges
for making me aware of just how badly I understated the degree to which this
book is utterly unsuitable for teaching C, and if I'd had to review a book
like this, I woulda been quite tempted to argue that it was simply unsuitable
for publication without MASSIVE revisions and corrections.

-s
 
S

Seebs

Schildt's CTCR2e, p502:

Now 483 in 3rd edition:
#include "stdlib.h"

long int get_labs()
{
char num[80];

gets(num)

return labs(atol(num));
}
Actually, of course, it does no such thing, because it won't compile.

And the wrong markers for the standard header, and no main. And no
declaration in scope for gets().

It's somewhat improved in 3E, where there's declarations for
num1[80], num2[80], they're both gets'd after prompts (no newlines
or flushes, of course) and then:
printf("The sum is: %ld.", atol(num1) + atol(num2));

So it's only wrong in the usual ways (no newline on output, for instance).

(BTW, that's a DOSism, as I recall -- I believe MS-DOS printed a newline
before the prompt, so DOS programmers often habitually omitted trailing
newlines in the last output.)

4th edition fixes main's return type but does nothing else.

-s
 
S

Seebs

Let's play the random game again. P298 of CTCR2e:
int fflush(FILE *stream);
[Schildt claims that fflush clears input buffers.]
Secondly, the behaviour of fflush() when passed a FILE *
that is associated with an "input file" is undefined.

Still broken in 3rd edition. In 4th edition, the claim about the input
file is gone, but the description is questionable; what about a file opened
for both reading and writing, on which the last operation was a read rather
than a write? Then the behavior is undefined. (We could argue that this
is a file "opened for update", not "opened for writing", but not telling
the reader that you can flush a file opened for both reading and writing,
and when you can do so, is ridiculous.)

But! The 3rd edition example:

fwrite(buf, sizeof(data_type), 1, fp);
fflush(fp);

A little clumsy, but sure.

The 4th edition example:
for(i=0; i<MAX; i++) {
fwrite(buf, sizeof(data_type), 1, fp);
fflush(fp);
}

The astute reader will notice immediately that this has gone from a
slightly unimpressive example to an overtly stupid one. This should be:

fwrite(buf, sizeof(data_type), MAX, fp);
fflush(fp);

.... Unless, of course, it was INTENTIONAL that it would write only the
first item in buf, MAX times. Who can say? Either it's an example of
how to do something extremely implausible, or it's another bug, INTRODUCED
in the 4th edition!

-s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,955
Messages
2,570,117
Members
46,705
Latest member
v_darius

Latest Threads

Top