I know Nilges will pay no attention to this, and may start calling
me names and making weird claims about how I assasinate his character
(as if I needed to - he does an exemplary job of that himself) and
threatening to sue me for libel, but it has to be said, for the
newbies in here who might innocently but bafflingly mistake Nilges
(spinoza1111) for someone sane, if for noone else.
Ol' square-britches (e-mail address removed) was jivin' on 24 Jun 2006
11:02:58 -0700 in comp.lang.c.
Re: Segfault City's a bad trip! Dig it!
I'm not a C "expert" by your lights, but I am an expert programmer, and
the above is one of the silliest things I've ever seen posted on the
net. You may be a "recognized C expert",
You're the only one I see claiming to be an expert. And yet you have
shown what sort of expert you are. As the old joke goes, an "ex" is a
has-been, and a "spirt" is a drip under pressure.
but you can't program and
should not be permitted to write software or write about software. Here
is why:
(1) You call the code a "straightforward test for numerics" but it
isn't any such thing.
It isn't? Well, what is it, then?
It assumes that the library contains an isdigit()
Which it must, if it is a standard conforming C library for a hosted
environment, as you have been told numerous times already.
function and doesn't "test" at all. Instead, using isdigit() it checks
for a digit (which makes your statement wrong and a lie because isdigit
What's wrong about it? He's checking for a digit by calling
isdigit(). How is that wrong?
does the work you claim "your" code does) and then converts the digit
to a number.
Indeed. That is the purpose of the functions Richard posted.
(2) Earlier this evening I mistook your code to fail if the character
value exceeded '9' because your code was so terribly wrong (in saying
No, his code is so terribly correct.
it was something it was not) that I actually overlooked (1);
What did the code say it is that it isn't?
you are
not making the test you say you are making.
Yes he is. What part of that don't you understand? He is checking
for a digit by calling isdigit(), whose purpose it to check for a
digit.
I was in a hurry because
I'm wasting my time replying to you.
Apparently so, since you refuse to listen and learn. But if you feel
that way, why are you replying?
To call the above code "straightforward" is obscene.
If by "obscene" you mean "correct" or "truthful" or "right".
Otherwise, what part of it do you not find straightforward?
You need to code
what you mean,
Indeed. He did. Just because you're so lacking in intellegence that
you can't understand it is no reason for you to fly off the handle.
Instead, ask about that which you don't understand, and someone will
endeavour to educate you.
and the minimal assumption you can make about digits is
that their value, when converted to an integer (whether byte, unsigned
or other) is inclusively between that of the integer value of '0' and
that of '9'.
Good for you! You got something correct. See; it's not all that
hard, is it? You and Richard and everyone else here who knows the
slightest thing about C are in agreement. The digit characters are
adjacent and in numerical sequence in the source and execution
character sets. This much has been guaranteed by the standard.
Now, in what way does that differ from what Richard has been saying
all along?
The value of letters in EBCDIC did not conform to this, but this was a
Of course not. Letters are not digits. The standard does not
guarantee anything about the order or adjacentness of letters in
either the source character set or execution character set.
mistake caused by the fact that Herman Hollerith, the designer of the
IBM punched card, needed "zone" bits.
And this has what to do with standard C?
It was fixed in ASCII. In all
ASCII which was designed *before* EBCDIC? So something that was
designed after something else is fixed by the thing after which it was
designed?
And the question remains, what does this have to do with standard C?
extant coding systems except perhaps obscure ones, digit values are
adjacent.
Correct (assuming "coding systems" means character sets, of course).
At least we can say that all character sets supported by the C
language have adjacent and sequential digit sets.
We're all in agreement on this, so why do you keep harping on about
it?
You may believe that a "standard" C programmer would always use isdigit
to ensure his code worked on non-ASCII, non-EBCDIC systems.
I don't know why you would think that. The fact that isdigit() works
for ASCII and EBCDIC and all other character sets that support the C
language is not really a major consideration in choosing that over an
expression like c >= '0' && c <= '9'. The fact that it is easier to
use and possibly more efficient is a major consideration.
The isdigit
function would then I suppose completely conceal the machine and code
dependent test and here, the code would be transportable between ASCII
and EBCDIC machines.
Indeed it would be, and to implementations that use other character
sets too. So would it be if you had used an expression like c >= '0'
&& c <= '9'. However, there is no need to do the latter when the
former suffices.
This would be a good thing. The problem is that actual working C
programmers can't be sure of having a fully conforming implementation
That's true. However, the chances of having a conforming
implementation are far greater than those of having a non-conforming
one. Conforming implementations exist for a vast range of systems.
Non-conforming implementations are few and far between. And even they
might have an isdigit() function.
for legacy code, and don't waste time if they're smart making legacy
programs conform to your favorite standard. And, you intentionally
mislead them, as a self-appointed C expert, by saying that your code is
a "straighforward test for numerics" when it is not.
Huh?
In your code, assuming that the C environment the programmer is using
(which doesn't have to be standard) has an isdigit, you don't break if
the digit value is greater than the value of 9. However, your code,
starting with your claim, is a lie, and you are posting (perhaps as a
paid agent) disinformation in a campaign of character assassination
So, there's someone out there paying Richard money to spread
disinformation? Who would do that and why? Really, you are a fool!
similar to that you conducted against Herb Schildt. **** you.
Weapons of the ignorant: outrageous claims and foul-mouthed personal
abuse.
You're a code monkey and on the job, if this is your style, your
interest is solely in spreading confusion, and, probably, office
politics and character assassination.
You know you're only making yourself look bad, don't you? Oh no, of
course you don't. Silly question! Well, allow me to enlighten you. You
*are* only making yourself look bad.
As much as you are, and probably more.
Plenty. What he's saying is that your code is unnecessarily obscure and
difficult to read. That's the mark of a bad programmer, unless your intent
is to win the IOCCC.
Obscure? Difficult to read? Give me a break. You say above that "this
would be a straightforward TEST FOR NUMERICS" [emphasis mine] and then
you use isdigit() to do the heavy lifting.
In what way is it obscure or hard to read to use a simple function
with a fairly obvious name to carry out a simple task?
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?