Re: Segfault City
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Sat, 24 Jun 2006 19:31:09 +0000
spinoza1111@xxxxxxxxx said:
Richard Heathfield wrote:
spinoza1111@xxxxxxxxx said:
Richard Heathfield wrote:<snip>
spinoza1111@xxxxxxxxx said:
Why are you posting?
Why are you?
Because you're engaged in a campaign of personal destruction as you
were with Schildt.
The important thing is that C students learn how to write C properly. The
characteristic you share with Schildt is that you are endeavouring to
teach C without actually knowing it, and /that/ is what is destructive.
The developer dot star post was not any attempt to "teach" C.
Quotes from the page:
"I had to develop an instructor solution to a simple C problem, the
calculation of primes using the Sieve of Eratosthenes."
"The first challenge in teaching the Sieve of Eratosthenes..."
"But as a teacher of C I plan to stress its flaws and its pitfalls from my
POV (point of view)."
You have certainly managed to stress some flaws and pitfalls, but they are
not C's flaws or pitfalls.
You've
concealed the fact that in the post there is full disclosure that I was
temporarily returning to C to do "global" computing,
No, I posted the URL to that page. Anyone who saw the code also had every
opportunity to read the accompanying blurb.
<snip>
My code may have been "obscure" if you so misunderstood the problem but
Oh, I understood the problem all right. Indeed, I understood it better than
you did. (That's why my program is so much faster than yours.)
you're hopeless if you can present a USE of a system function as the
solution.
Those who ignore the standard library condemn themselves to rewriting it.
You're a thief of intellectual property and a liar.
Whose intellectual property have I stolen? How have I lied? You'll have to
do better than "using isdigit() constitutes lying".
and your insistence that C is still usable for new development.
Well, that's certainly an opinion, although I doubt whether it will be
shared by many here in comp.lang.c.
Who? Amateur programmers, retirees with anger management problems, and
script kiddies?
To insult an entire newsgroup in one short paragraph is the work of a troll.
If you're interested in learning C, this newsgroup can be of tremendous
help to you. If you're not, I suggest you stop using it before your
software kills someone.
I am soooo scared.
No need to be. We're all very pleasant and well-mannered people most of the
time.
<snip>
I taught SAS C in 1989 when I was a daily user of C (today, I have, it
seems, forgotten more *real* C than you will ever know). EBCDIC C
programming is a rarity and in ASCII the programmer has to worry about
letters, which have what you call "code points" higher than '9'.
The ONLY sensible way to code the test remains
if (intCharValue >= [int]'0' && intCharValue <= [int]'9')
Firstly, that won't even compile. Secondly, when you correct [int] to (int),
you are casting an int to an int, which is utterly pointless. Thirdly, a
call to isdigit() is far clearer as well as being quicker to type, and it
may even run a bit faster, too.
NOT in the sense that this won't "break" someone's C environment but in
the sense that the final C code in a particular C environment has to be
an && condition which shows the minimal assumption, that digits are
adjacent.
This is guaranteed by the Standard.
Your big lie is that there is one C when in fact nearly all C
programmers have to use a dictated and not fully standard compiler.
Your code tells them to use a library function, isdigit(), which I
suppose is part of your Standard but may not be available elsewhere.
It's available in all hosted C implementations. I've covered this
elsethread.
I may have missed it. Perhaps it's a fundamental part of the toolkit of
every C programmer, and I am too dumb to see it.
Right.
Furthermore it is my understanding that most C library functions can be
coded in C. A conforming definition would use your Standard's guarantee
that the numeric value of digits are adjacent, and would be in fact my
&& test of being in the interval.
Certainly possible, but by no means certain. Here is a legal implementation
of isdigit(), which might reasonably be used in a library targeted at an
ASCII platform:
/* somewhere in the library code */
const int __is_digit[UCHAR_MAX + 1] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
/* in ctype.h */
extern const int __is_digit[UCHAR_MAX + 1];
#define isdigit(c) (((c) == EOF) ? EOF : __is_digit[c])
I may be mistaken but I believe Turbo C implemented it in approximately this
way.
<snip>
Your code doesn't "break" because it uses a magic function which isn'tIn ASCII, for which nearly all C code is written, the letters follow
the numbers! If the user enters A your "correct code" breaks?
Not at all. But to rely on the letters following the numbers (which, I
hasten to add, your code does not) would be silly.
available to all C programmers.
It's available to all C programmers on hosted implementations. Your own
program also uses functions that are only guaranteed to be available on
hosted implementations; isdigit() is just as portable as printf() in that
respect.
It doesn't do the job it says it will do.
Yes, it does.
Furthermore, it makes the legacy assumption that all characters are
bytes.
They are, by definition, in all conforming implementations.
<snip>
OK, I don't understand the Standard's guarantees.What this illustrates is the UNUSABILITY of the
standard, and consequently that it is extremely unwise, to the level of
professional malpractice, to recommend C for new development, as you
appear to.]
No, it illustrates that you don't understand the Standard's guarantees
about code points (see above).
Right.
But you don't know how to code clearly (and people who think your
code is clear are deceiving themselves), and you implemented a
solution that doesn't do the job you says it does.
Yes I do, and no they aren't, and no I didn't.
But then you say that there are "just 6 characters" as if the small
number of characters makes it probable that your code won't break!
No, I'm saying that to rely on character ordering that is not guaranteed
by the Standard renders code non-portable to systems where that reliance
is misplaced. I will again say, however, that your code does *not* fall
foul of this particular issue. We are discussing a minor point raised by
Andrew about a curious way of phrasing a character test, not an error in
your code.
As was the case in 2002, you've spread confusion again because your
purpose here is to character assassinate and trash, as in your campaign
against Schildt. You now admit that my code doesn't "fall foul".
Oh, but it does, in all kinds of ways. Just not in /that/ way.
Your claim was so outre that earlier this evening I understood you to
be claiming that you merely needed to test for greater than or equal to
zero to check for a number.
Then you need to read what I wrote, rather than what you fondly imagine I
wrote. I made no such claim.
<snip>
You seem to be using C on an IBM mainframe with the SAS compiler, and
pompously talking about C based on a misreading of the standard!
Please cite and explain the relevant section of the Standard that you
think I am misreading.
[elided] the standard, and [elided] you.
May I take that as an admission that you are unable to cite the relevant
section of the Standard?
You have lied consistently, about Schildt, in 2002, and here:
Not at all.
And if your compiler runs on an ASCII system, it has to jiggle
characters at runtime to make sure 9 is the "last" character.
No, not at all. You seem to have misunderstood my point completely.
And you are lying.
No, you have just completely and utterly misunderstood this subthread.
<snip>
C cannot be "standardized" because it is an
assembly language, and [elided] ISO if it makes this claim.
I'll let you take that up with ISO.
And icing on the cake..."it was also sufficiently grammatical THAN I
could understand it".
Do respond. I need a laugh and it seems you are ... well, not awake,
but posting. Are you drunk? Are you stoned?
No, but I am in the mood to write a Sieve. See below.
I am in NO mood to read your code.
Ah, such a shame. It would have been an education for you.
You are a cheap liar, a code monkey, and a thug.
Four errors in an eleven word sentence. I'm impressed.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- Follow-Ups:
- Re: Segfault City
- From: Old Wolf
- Re: Segfault City
- From: Dave Vandervies
- Re: Segfault City
- References:
- Re: Segfault City
- From: Andrew Poelstra
- Re: Segfault City
- From: spinoza1111
- Re: Segfault City
- From: Richard Heathfield
- Re: Segfault City
- From: spinoza1111
- Re: Segfault City
- From: Richard Heathfield
- Re: Segfault City
- From: spinoza1111
- Re: Segfault City
- Prev by Date: Re: Segfault City
- Next by Date: Re: Segfault City
- Previous by thread: Re: Segfault City
- Next by thread: Re: Segfault City
- Index(es):
Relevant Pages
|