Re: Requesting advice how to clean up C code for validating string represents integer



rem642b@xxxxxxxxx (Robert Maas, see http://tinyurl.com/uh3t) writes:
From: Flash Gordon <s...@xxxxxxxxxxxxxxxxxx>
Unfortunately
without access to the 1999 standard, this decision will be
difficult to implement.
(which was true at the time I wrote it)

Once again, you post hundreds of lines, only a fraction of it relevant.
Please try to restrain yourself.

And once again, *please* learn to quote properly. I've told you this
before. You seem to be constructing your own attribution lines, like this:

> From: John Doe <jdoe@xxxxxxxxxxx>
> ... stuff that John Doe wrote ...

The standard form is like this, or something similar

John Doe <jdoe@xxxxxxxxxxx> writes;
> ... stuff that John Doe wrote ...

Putting an extra "> " in front of the attribution line is very
confusing. It's possible that the "> " is being added by your
software because you use the word "From".

Just let your newsreading software construct the attribution lines for
your.

[...]

Linkname: The New C Standard: 6.3.2.1
URL: http://c0x.coding-guidelines.com/6.3.2.1.html
717 An lvalue is an expression with an object type or an incomplete
type other than void;^53)

So what's an "object type"??

You'll find the answer in 6.2.3p1, the section on "Types".

Linkname: The New C Standard: 6.5.3.4
URL: http://c0x.coding-guidelines.com/6.5.3.4.html
1108 The sizeof operator ...
1111 The result is an integer.
Huh? I thought it was supposed to be a size_t ??

1117 The value of the result is implementation-defined, and its type
(an unsigned integer type) is size_t, defined in <stddef.h> (and other
headers).
OK, that's better (phew!).

So you were able to answer your own question. Why did you find it
necessary to share that with us?

1119 EXAMPLE 2 Another use of the sizeof operator is to compute the
number of elements in an array:
sizeof array / sizeof array[0]
That's rather silly.

No, it isn't; it's a common and useful technique.

[...]

** Not a single mention of library functions, which is the major
topic of discussion/debate here (C90 vs. C99 vs. GNU C etc. such as
strtoll). In fact, with this entire document, it's not even
possible to learn what's needed to write a Hello World program.

Huh? Did you look at section 7, which fully describes the standard
library?

Let me take a look at the **other** file, 1.3 megabytes, which I
downloaded the other day ... <verbose>***, it took me a while to
find where I downloaded it to.
[...]

Nobody cares where you downloaded the file; please don't waste our
time telling us the boring details.

[...]
[#2] Implementations that do not support a signed zero (see
annex F) cannot distinguish the sides of branch cuts.

See what I mean? **UNDEFINED**BEHAVIOUR** !!!!

Why don't they just say that 99.9% of the machines, which use two's
complement arithmetic instead of sign-and-magnitude arithmetic,
can't possibly implement a conforming C using machine arithmetic??

Two's-complement applies to integer arithmetic, not to floating-point
arithmetic. Most systems these days use IEEE floating-point, which
does support signed zeros.

[...]

Hey, does the Pope know about you?

*Try* to stay on-topic. I'm about to give up on wading through all
the irrelevant crap you post. I'm probably one of the very few who
didn't give up some time ago.

[...]

There are far too many misconceptions in your web pages, such as
being able to compare unrelated pointers, ...

So long as the pointers are of the same type, there's nothing
impossible with comparing them, which will tell you whether the
objects pointed-at are this way or the opposite with respect to
each other in memory. If you think a program is not able to compare
the pointers, please explain your reasoning.

Section 6.5.8, "Relational operators", describes the behavior of the
<, <=, >, and >= operators. You'll find that applying such an
operator to two pointers that don't point into the same object (or
just past it) invokes undefined behavior.

[...]

* being for dynamically allocated objects only, [] being for
"static-allocated" objects only.

I'm sure I never said any such thing. You're misreading, or lying.

Don't throw around accusations of dishonesty unless you're very sure
of yourself.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.