C the complete nonsense

J

J de Boyne Pollard

I just tried posting it through Google Groups myself;
it wrapped around (something a reader can easily cope
with), and there was no ellipsis.  

You've not dealt with enough readers. Come back when
you've been through the process as many times as I
have.
I'm not interested in whatever "silly dance" you're
talking about.

Post as you have been posting, and you won't have a
choice in whether to dance it or not.
I don't know what you're talking about, but I
don't care enough to ask.  Feel free to be clearer
if you want to share knowledge rather than show off.

Now that was a rather stupid thing for you to say,
given that in the very post that I replied to you
asked *not* to be given the lengthy explanation. As
mentioned, the knowledge already is shared. There's
been a Frequently Given Answer on this published to
the world for ... <click><click> ... at least six
years.
 
J

J de Boyne Pollard

There you go.  You actually *did* know that this
Sorry to butt in, but why do you say that Tinyurl
(or any of several similar services)  "doesn't work
in practice"?

Because the next step in the silly dance is all of the people
complaining "I/my network administrator/my company refuse to
follow URLs from TinyURL, because the text displayed in my
status bar doesn't show what WWW page I'll actually end up
at.". And the step after that is where they tell you at
length why preview mode is just as bad. If you've been
through the dance often enough, as I have, you'll recognize
the steps.

Get yourself a WWW site whose URLs are necessarily quite
long, put helpful content on it, and try pointing people
to it for a decade or so. You'll find that the belligerent
silliness of M. Thompson here, trying to make out that xe's
been mortally offended by simply being no more than pointed
towards something that would actually help xem, is but one
example of the many creative ways that humans have found to
react stupidly to being helped. (-:
but your alternative of not giving an address at all

That's not my alternative. As *noted in the original posts*,
I sent hyperlinks to the people concerned *right at the
start* -- before posting, even. You're thinking of the
alternative of the people who don't believe in using the
right tools for the job, such as hypertext for hyperlinks,
of whom am I not one.
Of course, your quote of the longer URL above was mangled
by Google.

Exactly. And it will be mangled by NUAs that word-wrap it
in quotations, mangled in Usenet gateways, mangled in
archives of Usenet postings accessible from the WWW, and
mangled by programs that "helpfully" do things like
replacing slashes, minus signs, and other characters in
URL-like text with various kinds of quoting sequences.
You should see some of the broken incoming links that
Google Webmaster Tools reports pointing to my WWW pages.
And those are just the ones where the breakage has
occurred far enough into the URL to miss the domain names
and account names.

Ask yourself this: Do we give out hyperlinks with the
intention that people are able to follow them and read
what is hyperlinked to, or just to decorate postings?
Only in the latter case does it not matter that people
reading the post, and quotes of the post, and copies of
the post on WWW sites, will get something mangled and
unusable.

And that's even discounting all of the
but-that-hyperlink-doesn't-work-for-me timewasting that
occurs.
Okay, I'm sure this is a stupid question, but
what is a "CIS URL"? You don't appear to be in
Russia....

Go to the Frequently Given Answer that you already
know about, hit your WWW browser's "Up" button on
its navigation toolbar, scroll down in the index
to the World Wide Web section, and read the FGA
mentioned above.

Or put "CIS URLs" into Google Web, where you'll
find the FGA usually on the first page of results.

Or read RFC 1738. (-:
 
J

J de Boyne Pollard

If what you say is right then we've actually discovered
That's an easy one. There are a lot of deluded people out
there.

I disagree. One doesn't necessarily know that a book is
poor, or at least not what one thought it to be, when one
buys it. The choices set forth by M. McLean are not
exhaustive, and are really a false dichotomy.
 
J

J de Boyne Pollard

There is a character, whose value is 26, that a lot of the
sounds odd. So a text file written in say pascal
wouldn't do this?

If the Pascal compilers' libraries didn't do the same
thing, then no. I've not looked at anywhere near enough
Pascal implementations for DOS to tell you who did what
in this regard.
So why did C libraries do it?

The most widespread explanation is that it gave DOS
programs the same semantics as CP/M programs. It's
worth remembering that at the time that all of these
decisions were being made, Unix wasn't the One True
And Obvious Way to do things. The command-line
syntax of MS/PC/DR-DOS commands comes more from VMS,
for example. The imitating CP/M explanation rings
true, and is oft-repeated, to the extent that most
people take it to be true. But I don't know of
anything authoritative from the actual compiler
designers explaining why this came about in the
first place. This could instead have been the result
of (say) a design decision made for ROM BASIC in
the IBM PC. (-:
I never said it did.

You've been in this newsgroup too long. Not everything
in a posting is someone trying to tell you that
everything that you say is wrong. Sometimes, just
sometimes, on Usenet people are actually having normal
conversations. (-:
 
M

Malcolm McLean

I disagree.  One doesn't necessarily know that a book is
poor, or at least not what one thought it to be, when one
buys it.  The choices set forth by M. McLean are not
exhaustive, and are really a false dichotomy.
If you sell something under false pretences then of course you get a
few sales. But Schildt is the best-selling C author. His sales go into
the millions. It's most unlikely that so many people are buying the
book on the basis of its cover, then regretting their purchase. And
it's not as if the anti-Schildt lobby is being censored - I've tried
to find a positive review of the book from a notable name, and so far
failed. The books must be valuable to the people who buy them.

You're right, however. it's not really a dichotomy - mass delusion
versus the books are valuable - there might be another explanation.
It's just that no obvious one presents itself.
 
W

Willem

Malcolm McLean wrote:
) If you sell something under false pretences then of course you get a
) few sales. But Schildt is the best-selling C author. His sales go into
) the millions. It's most unlikely that so many people are buying the
) book on the basis of its cover, then regretting their purchase. And
) it's not as if the anti-Schildt lobby is being censored - I've tried
) to find a positive review of the book from a notable name, and so far
) failed. The books must be valuable to the people who buy them.
)
) You're right, however. it's not really a dichotomy - mass delusion
) versus the books are valuable - there might be another explanation.
) It's just that no obvious one presents itself.

Most people who buy the book are those who wisth to learn C, and are
therefore inherently unqualified to judge the quality of the book.

This would, of course, imply that there are millions of people out there
who now make the same mistakes as Schildt does. Which makes sense, given
the poor average quality of C code floating around.

I work at a large company. One of the languages used is C. I have
not gone through all the code in detail, but thus far I have fixed one
program that had intermittent failures, because it was using a
while(!feof()) loop. Most of the times, it worked, by sheer luck.

I have also seen lots of other errors involving a basic misunderstanding
of C.

Now, I wonder if those people learned C from Schildt's books, but in
any case it's a good data point for the existence of a lot of people
who don't know C well enough to judge a book on the subject.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
C

Colonel Harlan Sanders

Because the next step in the silly dance is all of the people
complaining "I/my network administrator/my company refuse to
follow URLs from TinyURL, because the text displayed in my
status bar doesn't show what WWW page I'll actually end up
at.". And the step after that is where they tell you at
length why preview mode is just as bad. If you've been
through the dance often enough, as I have, you'll recognize
the steps.

Get yourself a WWW site whose URLs are necessarily quite
long, put helpful content on it, and try pointing people
to it for a decade or so. You'll find that the belligerent
silliness of M. Thompson here, trying to make out that xe's
been mortally offended by simply being no more than pointed
towards something that would actually help xem, is but one
example of the many creative ways that humans have found to
react stupidly to being helped. (-:


That's not my alternative. As *noted in the original posts*,
I sent hyperlinks to the people concerned *right at the
start* -- before posting, even. You're thinking of the
alternative of the people who don't believe in using the
right tools for the job, such as hypertext for hyperlinks,
of whom am I not one.


You didn't send the address to me. And anyone who happens across this
post in the future would also be left out of the loop. And many
people, myself included, do not advertise their email address on
Usenet.
If you only want to communicate with select group of "people
concerned", then do the whole thread by email rather than making a
puzzle out of the Usenet thread.

Exactly. And it will be mangled by NUAs that word-wrap it
in quotations, mangled in Usenet gateways, mangled in
archives of Usenet postings accessible from the WWW, and
mangled by programs that "helpfully" do things like
replacing slashes, minus signs, and other characters in
URL-like text with various kinds of quoting sequences.
You should see some of the broken incoming links that
Google Webmaster Tools reports pointing to my WWW pages.
And those are just the ones where the breakage has
occurred far enough into the URL to miss the domain names
and account names.

Ask yourself this: Do we give out hyperlinks with the
intention that people are able to follow them and read
what is hyperlinked to, or just to decorate postings?
Only in the latter case does it not matter that people
reading the post, and quotes of the post, and copies of
the post on WWW sites, will get something mangled and
unusable.

And that's even discounting all of the
but-that-hyperlink-doesn't-work-for-me timewasting that
occurs.

You've wasted far more time in this long justification for your
refusal to post links in Usenet posts, despite several simple and
reliable methods being suggested.

1) Just paste the damn link as-is. If it gets broken by your Usenet
agent (Google?), I'm sure readers of this group will be able to
repair it.
1a) Break the URL yourself into 40 character lines and advise the
reader to paste them together.
2) Use TinyUrl, or any similar service; or a Pastebin.
3) Add a note that if anyone has a problem with the URL to email you,
since you seem to be happy to do that.

And many other methods; all of which would be easier both for you and
the readers than finding email addresses and sending a URL out of
band.

Go to the Frequently Given Answer that you already
know about, hit your WWW browser's "Up" button on
its navigation toolbar, scroll down in the index
to the World Wide Web section, and read the FGA
mentioned above.

Thanks, but I didn't really expect that a FAQ on DOS EOF markers would
be related to Whatever the Hell CIS URLs are, so I did not look at the
rest of that site. From the snarky tone of your reply I suspect now
that when you say "Frequently Given Answer" that you are in fact
referring to your website, not a generic "Frequently given answer",
if so, WHY NOT SAY SO?

Or put "CIS URLs" into Google Web, where you'll
find the FGA usually on the first page of results.

Again, thanks a bunch.
I actually have heard of Google. I did search for "CIS URL" and found
nothing enlightening. Of course, "CIS URLs" does give your link.
Everything is so clear when you already know what the answer is and
where to look.

So while I do appreciate the information you provide, it does seem
that you make giving a URL into a needlessly dramatic and complex
affair.
Are you actually trying to be helpful, or looking for an opportunity
to sneer at people for not knowing how to decipher your references?
 
S

Seebs

book on the basis of its cover, then regretting their purchase. And
it's not as if the anti-Schildt lobby is being censored - I've tried
to find a positive review of the book from a notable name, and so far
failed. The books must be valuable to the people who buy them.

Non-sequitur. You have yet to show that any person has bought a second
one.

However, a quick look at Amazon reviews gives a plausible explanation.

Schildt's bad explanations are, for the most part, quite consistent.
Look at the way he "explains" EOF. He shows sample code. He explains that
the sample code will fail "on binary files". Sure enough! If you run that
code on a file people would typically think of as a binary file, on a
typical MS-DOS or Windows system, it almost certainly fails in the way he
describes. He reveals a solution -- a way to avoid that failure. Sure
enough! His proposed solution appears to mitigate the problem.

The victim now believes that Schildt has imparted to him knowledge of a
tricky pitfall in C, as well as a solution -- a way to avoid that pitfall.
He notices that many other programmers don't know about this pitfall, or
use that solution. He concludes that Schildt's book is very good -- it
covered something many people don't know about.

He recommends Schildt's book, confidently... Unaware that there was never
any problem except that Schildt didn't know what he was doing, and the simple
standard code everyone else is using works fine and is both simpler and
more reliable than what Schildt demonstrated.

Basically, Schildt is living large off the low end of the Dunning-Kruger
curve; people who think they learned C from his books are likely to imagine
that they learned C very well, but in practice, most of them take years
to recover.

-s
 
K

Keith Thompson

Colonel Harlan Sanders said:
Thanks, but I didn't really expect that a FAQ on DOS EOF markers would
be related to Whatever the Hell CIS URLs are, so I did not look at the
rest of that site. From the snarky tone of your reply I suspect now
that when you say "Frequently Given Answer" that you are in fact
referring to your website, not a generic "Frequently given answer",
if so, WHY NOT SAY SO?

For anyone who still cares, the '.' in the URL is explained at

<http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/web-fully-qualified-domain-name.html>

or, for those using broken news software:

http://homepage.ntlworld.com./jonathan.deboynepollard/
FGA/web-fully-qualified-domain-name.html

The "CIS" is an abbreviation for "Common Internet Scheme", a term
defined in RFC 1738, <http://www.ietf.org/rfc/rfc1738.txt>. (That's
easy to miss when reading the web page; the first use of the
abbreviation CIS occurs more than a page after the only occurrence of
the phrse "Common Internet Scheme".) I don't recall hearing the term
CIS or "Common Internet Scheme" before. As it happens, the vast
majority of URLs, including all that start with "http://" or "ftp://",
use the Common Internet Scheme. (The RFC never refers to this as
CIS.)

[...]
So while I do appreciate the information you provide, it does seem
that you make giving a URL into a needlessly dramatic and complex
affair.
Are you actually trying to be helpful, or looking for an opportunity
to sneer at people for not knowing how to decipher your references?

Personally, I suspect the latter.
 
N

Nick

Seebs said:
On Apr 5, 4:58 pm, jacob navia <[email protected]> wrote: [naviaisms]
This is not the kind of attitude that will lead people to want to use
your container library.
it seems an odd way to judge software. Do you only buy software from
people you like. presumably the success of the open source movement is
down entirely to Stallman's wit and charm.

No, but I'd guess that free software would have achieved broader adoption
sooner if Stallman had more charisma (and, dare I say it, social skills).

I have seen quite a few people argue, persuasively, that the key advantage
FreeBSD had over NetBSD in market penetration was that Jordan Hubbard was
a persuasive evangelist.

The whole subject is something that ESR goes on about at great length in
The Cathedral And The Bazaar, IIRC.
 
N

Nick

(examples from C:TCR)
[1] For example:

char ch;
/* snip */
while(!feof(in)) {
ch = getc(in);
if(!feof(in)) putc(ch, out);
}

or:

while(!feof(fp)) {
fgets(str, 79, fp);
printf(str);
}

or:

char c;
/* snip */
do {
ch = getc(in);
/* snip */
if(ch=='\t') {
/* snip */
}
else {
putc(ch, out);
/* snip */
}
} while(!feof(in));

or:

while(*str) if(!ferror(fp)) fputc(*str++, fp);

or:

while(!feof(fp)) putchar(getc(fp));

Looking at these makes me realise that I don't think I've /ever/ used
feof in my life. Trying to read until there is nothing more works so
well.

Does feof have a real use I've somehow missed (the examples above are
clearly not it - they can all be improved by not using the function).
 
M

Malcolm McLean

Does feof have a real use I've somehow missed (the examples above are
clearly not it - they can all be improved by not using the function).
You're parsing a file, eg a script file. You check for the "end of
script" token, for the sake of argument the word "END". However if
characters follow the "END" the script has a syntax error, which must
be reported. So chomping whitespace and checking for feof() is a
reasonable thing to do.
 
W

Willem

Nick wrote:
) Looking at these makes me realise that I don't think I've /ever/ used
) feof in my life. Trying to read until there is nothing more works so
) well.
)
) Does feof have a real use I've somehow missed (the examples above are
) clearly not it - they can all be improved by not using the function).

Well,

Euh...

As far as I know, no. I don't think I ever used it either.

Of course, I assume you *do* use ferror() to check for errors when you
get an EOF on a read. IIRC, the only two reasons you can get EOF is
when you either have an error (ferror()) or end of file (feof()).

I guess for robustness you could check both.

Feel free to correct me if I'm wrong here.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
B

Ben Bacarisse

Nick said:
(examples from C:TCR)
Looking at these makes me realise that I don't think I've /ever/ used
feof in my life. Trying to read until there is nothing more works so
well.

Does feof have a real use I've somehow missed (the examples above are
clearly not it - they can all be improved by not using the function).

I've used it on occasion. The most common case would probably be to
determine why an input loop ended when it can end in many ways. To take
a rather contrived example:

int c;
while ((c = getchar()) != EOF) {
/* process c by adding it to some buffer */
if (match(buffer, search_string))
break;
}
/* what happened? */
if (c == EOF)
return feof(stdin) ? NOT_FOUND : IO_ERROR;
/* process the buffer */

After the loop, c == EOF tells us that something went wrong but that
includes both end-of-file and input errors.
 
W

Willem

Malcolm McLean wrote:
)>
)> Does feof have a real use I've somehow missed (the examples above are
)> clearly not it - they can all be improved by not using the function).
)>
) You're parsing a file, eg a script file. You check for the "end of
) script" token, for the sake of argument the word "END". However if
) characters follow the "END" the script has a syntax error, which must
) be reported. So chomping whitespace and checking for feof() is a
) reasonable thing to do.

You just made the same mistake as Schildt:

After you read 'E' 'N' 'D' from the file, feof() will *not* be true,
even if it were the last three characters in the file.
The *correct* thing to do is to check if the next read returns EOF
or not.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
W

Willem

Ben Bacarisse wrote:
) I've used it on occasion. The most common case would probably be to
) determine why an input loop ended when it can end in many ways. To take
) a rather contrived example:
)
) int c;
) while ((c = getchar()) != EOF) {
) /* process c by adding it to some buffer */
) if (match(buffer, search_string))
) break;
) }
) /* what happened? */
) if (c == EOF)
) return feof(stdin) ? NOT_FOUND : IO_ERROR;
) /* process the buffer */
)
) After the loop, c == EOF tells us that something went wrong but that
) includes both end-of-file and input errors.

I'd use ferror() for that. But that is a matter of taste.

If you read an EOF, then ferror() == !feof() (I think).

Also, I don't see the need for a contrived example where you sometimes
break out of the loop, if you then check for EOF anyways.

Perhaps you meant to write the following:

if (feof(stdin)) return NOT_FOUND;
if (ferror(stdin)) return IO_ERROR;

Then I could see the reason for your contrived example.


Another contrived example could involve clearerr(), perhaps ?


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
M

Malcolm McLean

Malcolm McLean wrote:

)>
)> Does feof have a real use I've somehow missed (the examples above are
)> clearly not it - they can all be improved by not using the function).
)>
) You're parsing a file, eg a script file. You check for the "end of
) script" token, for the sake of argument the word "END". However if
) characters follow the "END" the script has a syntax error, which must
) be reported. So chomping whitespace and checking for feof() is a
) reasonable thing to do.

You just made the same mistake as Schildt:

After you read 'E' 'N' 'D' from the file, feof() will *not* be true,
even if it were the last three characters in the file.
The *correct* thing to do is to check if the next read returns EOF
or not.
No, I chomped whitespace.
 
N

Nick

Seebs said:
No, it means either that or "always". Both usages exist in English, and
the phrase is ambiguous.

I have to say, purely as a point of English usage, that to me "in
general" (as a two word phrase, rather than other uses of "general")
means only "most of the time" or similar, not "always". There's no
point qualifying what would already be an absolute statement with it
unless it changes the meaning.
The book is crap. Here, let's play Random Page!

Now this I agree with. So let's join in.

Page 288... Whaddya know" In the 4th edition, if there's an error, it's
too subtle for me. On the other hand, it's purely an enumeration of the
C99 _Pragma() feature and the __VA_ARGS__ macro expansion feature. So
let's look in the 3rd edition.

The header file associated with the I/O functions defined by
ANSI is called STDIO.H.

In the second edition, page 288 is the next page on from this. It's all
too dossy for me to know how right or wrong it is, but...

- there's an example of void main.
- double quotes are used to include a header file supporting a function
that "is commonly included in the library of DOS-based compilers" (this
seems widespread - stdio.h on the next page is treated similarly).
Maybe not an actual error, but none conventional to say the least.
For many C compilers, the header file related to the UNIX-like file
system is called IO.H.

Never heard of such a header, even allowing for the bogus caps. Anyone
know whether it's a DOSism?

That just sneaks onto the top of the page, so we can count this one as
well.
 
N

Nick

J de Boyne Pollard said:
Time for you to read some Usenet FAQs. Moving a discussion of MS-DOS
programming to the newsgroup for MS-DOS programming is hardly "playing
around". Don't unthinkingly follow the bad example of Rod Pemberton's
cluelessness, here. Put the thinking cap on and think!

From the man who consistently de-attributes everything this is just a
tad rich.

Time to move another local kill file entry global I see.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top