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

  • Thread starter robert maas, see http://tinyurl.com/uh3t
  • Start date
K

Keith Thompson

Flash Gordon <[email protected]> wrote:

[attribution line corrected]

[...]
I'm considering putting you on my "hurt list", people who
deliberately say hurtful things to me but make no comparable effort
to ameliorate whatever is bothering them so much to provoke them to
make such statements. You'll be listed alongside the people who
accuse me of being a pedophile or child molestor, the writer for
the San Jose METRO newspaper who wrote a grossly dishonest and
demeaning article about me, and the social worker (Michele Dove)
who lied to the court to provoke it to take my children away
without due process and who also lied to the psychiatrist doing my
psychlogical evaluation to change his mind where he had said I'm
under stress but he sees no reason why I would be a danger to my
children, but after she lied and told the psychiatrist that I had
been found by the court to have abused my children **before** the
hearing where she was supposed to present her allegations and have
them considered, the psychiatrist added a section to the bottom of
his report that says considering that additional information that I
was already (FALSE!!!) found to have abused my children he
recommends the children be taken away, contrary to his opinion upon
conducting the original psychological evaluation, so when there was
supposed to be a hearing to determine what veracity if any there
was to her false allegations, the judge ruled summarily against me
and refused to give me the right to a trial with witnesses I can
cross-examine.

Ok, I'm going to give this one last try.

Imagine an open classroom on, say, a college campus. This particular
classroom is dedicated to discussions of the C programming language.
Everyone is free to drop in and join the discussion, and there's
plenty of room. After a while, there's even a sense of community.

I walk in, sit down, and start asking and answering questions. But
they some guy comes in, sits down next to me, and insists on spending
class time talking about his personal problems and complaining about
the general lack of sympathy.

This is a problem, and everyone starts nervously moving away from this
guy. It's not that we're unsympathetic to his problems; he's just
choosing a poor and disruptive way of dealing with them. And there
are other classrooms (hint: newsgroups) where I'm sure they'd be glad
to hear about his personal situation and do whatever they can to help.
But this classroom is for discussion of C, and even if we wanted to
spend class time helping him, we just don't have the expertise or
ability to do so. And the problem is, he *also* talks about C, which
makes some of us hesitant to ignore him, but eventually enough is
enough.

The analogy isn't perfect. comp.lang.c isn't a classroom, and nobody
can really monopolize our time. We can't, and don't necessarily want
to, prevent you from posting. But we can easily ignore you. We can
even automate the process of ignoring you by using a killfile. I
suspect a number of people here have already done so.

I truly wish you the best of luck with your personal situation, but
this is not the place to discuss it. If you want to discuss C, you're
welcome here; if not, I wish you luck in finding a more appropriate
forum.
 
F

Flash Gordon

Robert Maas, see http://tinyurl.com/uh3t wrote, On 20/03/07 22:00:
That's my current wannado. Unfortuately while I've at long last been
able to find and download a text version of:
WG14/N869 Committee Draft -- January 18, 1999
I haven't yet found anything comparable for C1989-90, so even using
'grep' to test for mention in C1989-90 isn't yet feasible.

You've been given references to where there is a link to the last draft
of the C89 standard before. Admittedly the actual link to the C89 draft
was broken until a short time ago, but you obviously never bothered
trying it or you would have reported it. If you read you will find a now
working link to it at http://clc-wiki.net/wiki/The_C_Standard
The 'man' pages here for gcc tell **only** how to run the program,

Nope, that's not what I need to find.

As I know has been mentioned before, "man func". E.g. "man fread".
Should I check if the Sunnyvale public library has any of them??
What's the chance of that?? <ot>A few months ago I looked for
Dawkin's "The God Delusion" and learned they have just one copy,
with about fifty people on the wait list for it.</ot>

If you can't be bothered to check it is your own fault that you do not
have access to a decent book.
I'm considering putting you on my "hurt list", people who
deliberately say hurtful things to me but make no comparable effort
to ameliorate whatever is bothering them so much to provoke them to
make such statements.

Do you think that actually bothers me? You have repeatedly failed to
take advice and correct errors. Your site still contains at least one
basic error that I have pointed out to you, and if you can't fix it from
just knowing the line is in error you *definitely* don't know enough
about C to be writing anything about it and should take the site down
and start reading a decent text book or tutorial and not publish any
reference material until you actually know the language. Currently your
site has negative value because it is such poor quality that the only
people who will "learn" anything from it will not realise how bad it is
and so what they learn will be incorrect.

To write something with either zero or positive value requires at a
minimum a very good knowledge of the subject material AND skill at
writing reference material or tutorials, not many people have both.
> You'll be listed alongside the people who
accuse me of being a pedophile or child molestor, the writer for
the San Jose METRO newspaper who wrote a grossly dishonest and

<snip rant about everyone being out to get Robert Maas>

What do you think any of that lot has to do with this group? Perhaps
somewhere in alt.support.* would be a better place for you to discus
that lot.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Chris Dollin said:
There are only values, so if assignment assigns to something, it
must be a value.

A value cannot exist unless it exists somewhere. There's no such
thing as just existing without being anywhere. The location where a
value exists is not itself a value, it's a place, a.k.a. location.
Consequently, if there are values, then there are also places,
which are two distinct types.

At the abstract level there are also equivalance classes of values.
Given any equivalence relation on values, such as bitwise and
structural identity, there are equivalence classes of values modulo
that equivalence relation. For example, the 16-bit integer
1010010101010111 and the 16-bit integer 1010010101010111 are two
distinct objects, both structurally strings of ASCII characters in
binary notation, with identical bit patterns, hence in the same
equivalence class modulo such structural comparisons, but located
in two different places, at the left margin and about 2/3 of the
way toward the right margin. (And the copies of those
string-numbers that you see on your machine are two additional
instances of that equivalence class, on *your* machine instead of
mine, which are probably in locations miles apart from my two
instances.)

In a machine, when talking about assigning a value, it's a copy of
a value that is assigned, not the original value, hence we're using
the word "value" to mean an equivalence class rather than a single
instance. The precise definition of such an equivalence relation
would involved causality, that if a value is copied directly it's
the "same" (modulo the equivalence relation) whereas if an equal
value happens to arise independently it's not the "same" value even
though it's an "equal" value.

When you think of it, that's why you need runtime equality
checking, to determine, in the case of two values which are not
"same", nevertheless whether they happen to be "equal" anyway. If
you copied a value directly and then tested for equality,
long int x; long int y=42;
x = y;
if (x == y) ...equalaction...; else ...diffaction...;
the compiler could recognize the tautological nature of the
comparison and optimize it to be done at compile time and generate
a runtime constat TRUE value
long int x; long int y=42;
x = y;
if (TRUE) ...equalaction...; else ...diffaction...;
instead of a runtime comparison to compute a TRUE/FALSE value which
is always TRUE. In fact the optimizing compiler could eliminate the
test entirely and not even compile the unrerachable code.
long int x; long int y=42;
x = y;
...equalaction...; /* Unreachable code ...diffaction...; */
But if two values are generated independently, there's no way the
compiler can know whether they will be equal or not a runtime, so
an actual runtime comparison must be compiled.
long int x; long int y=42;
scanf("%d", x);
if (x == y) ...equalaction...; else ...diffaction...;
I don't. (But is has some of the same behaviours.)

I've recently decided that due to the C-biassed definition of
"pointer", then perhaps "effective address" is the correct jargon
to use. But on the other hand, so-called "lvalues" in C have a size
and intentional type as well as just a machine address, so maybe
"effective address" doesn't really capture the whole nature, so
maybe "effective datatyped pointer" or "datatyped effective
address" is more accurate jargon. The idea is you have three things
intertwined:
- The machine address of the first addressible unit of storage;
- The number of addressible units, or contrarywise the byte
position within a single addressible unit, such as 7-bit ASCII
byte within 36-bit addressible unit on PDP-10 or 16-bit UCS-16
character in Java 1.3 on a 32-bit or 64-bit computer;
- The meaning of that storage, whether 2's-complement integer, or
unsigned integer, or IEEE floating point value, or ASCII
character, or EBCDIC character, or IBM-PC character, or Latin-1
character, or UCS-16 character, or 32-bit Unicode character, or
UTF-8 byte which may be a full ASCII character or just part of
any other UniCode character, or a bitmask, or a bitmask
representing a subset of a particular universal set, or a
boolean where all but one bit are ignored, or a boolean where
all bits zero means FALSE and any other combination is treated
as if TRUE, etc.
That entity is either a loadtime constant (compiletime constant
subsequently adjusted i.e. offset by loader), such as for a static
variable, or a runtime-offset value, such as stack-allocated
variable which is compiletime constant offset from stack pointer,
or fully runtime computed value, such as array element or
dereferenced pointer. But whatever the nature of generating that
entity, what you end up with (just before you fetch the value there
or store a new value there or just pass the entity as a parameter
to some other function), the entity has those three properties the
same in any case, however it was generated. I'm leaning toward that
last jargon I invented "datatyped effective address" to clearly
show that it isn't necessarily a compiled constant (hence the
"effective"), that it has an address as part 1 (hence the
"address"), and that it has both size and meaning (hence the
"datatyped" which includes both concepts together, which is why
both sizeof(type) and static_cast (C++ jargon which clarifies
what C casting usually does) work).
This is not the time nor the place for a tutorial on the
fundamental concepts of programming languages. So I won't
give one. Do your own homework.

The purpose of asking for you to explain what precisely you mean is
that you have been ambiguous and I don't understand what you are
saying but if you explain precisely what you mean then perhaps I
will finally understand which of several possible interpretations
of your previous utterances is correct. Unless my homework involves
kidnapping you and using torture or sodium pentathol to force you
to reveal what you mean, there's no way my "homework" can resolve
the question as to your intended meaning. It's up to you to either
explain what you meant, as I requested, or refuse, and have me
dismiss everything you ever said that wasn't fully
clear/unambiguous. If you choose to post ambiguous garbage and then
refuse to clarify, i.e. if you refuse to communicate meaingfully,
that's your choice.
, happens when/where? In the compiler during
compilation? Or at runtime?? Or some other time?
It doesn't matter when, so long as the right [defined by
specification] answer is arrived at.

The so-called specification (C1999) is not a specification at all
because it's ambiguous, leaves some issues totally unresolved,
undefined, really basic things like "lvalue" which is used all over
the place. My choice at the moment is to dismiss those parts of the
so-called specification as garbage and simply ignore them and
substitute my own personal explanation of what happens with an
"assignment".
It's the store, the place where values live:
update( store, lvalue, rvalue )
delivers a new store which is the same as `store` except the
value at `lvalue` is now `rvalue`. Perfectly straightforward
denotational semantics.

Ah, thanks for explaining the notation you were using in that
example. Such is actually implementable using a BST to
emulate/implement the store, where for efficiency (both space and
time) the BST-store object you get back shares all structure with
the original BST-store object except for the log(n) path down to
the single location which was updated between the old and new
BST-store objects. (I've actually written code like that, in lisp
of course. Someday maybe I'll try the same functionality in
PHP/perl... I wonder if there's any relational-database system that
supports such functional-language-style updates.)
lvalues are identifiers for places to put things

I really like that way of putting it!! I'm going to pounce on you
and not let you retract that! Like I've been saying all along, an
<cJargon>lvalue</cJargon> is very much like a
<lispJargon>place</lispJargon>, and the lisp jargon is less
confusing, and I'm pleased you've essentially adopted the lisp
jargon "place" here. As for the distinction between the identifer
for a place and the place itself, that's too nitpicky to be worth
distinguishing in most of this discussion. Technically an lvalue is
the place itself, not the identifier of that place, but that's too
nitpicky a distinction here.
I don't know how you'd know that.

Because what they say *about* lisp is so grossly wrong that nobody
who knew beans about lisp beyond the look of the syntax would ever
say such a thing about lisp. It's like if somebody told you that C
can't be used for anything except device drivers and operating
systems, you'd know the person didn't have any clear idea of C,
right? Way back in the days of MacLisp, timing tests showed that
lisp used for numerical calculations was slightly faster than
fortran, generating identical machine instructions within each
individual function, but having more efficient linkage when one
function calls another. Yet people who knew next to nothing about
lisp still claimed, to this day, that lisp is horrendously slow,
totally unsuitable for tight calculations, a totally false claim
from know-nothings. Likewise people are still saying that lisp is
suitable only for A.I., not for day-to-day data-processing
applications, again totally false from know-nothings.

Even the fact that people use c for applications that would be much
more appropriate in lisp show widespread lack of understanding of
lisp. Like why would somebody spend a month writing a new one-time
application in c, and never getting it fully working, when it would
take three or four days in lisp and be fully working from the
get-go, except if they really didn't understand lisp.
I haven't dismissed /any/ Lisp jargon.

Yes. I misunderstood you previously.

I'm interested in understanding how that is possible, but it's
getting seriously off-topic here. Would you be willing to explain
it to me privately, or in an appropriate newsgroup?

Yes: by calling that function's updater. The expression
V -> F(X) is compiled as (F.updater)(V, X)
There's only one rewrite rule, not one per "setf method".

OK, so F isn't a function, it's an <oop>object</oop>, where the
getvalue method and the update method are both contained in the
object, and so presumably getting a value also involves a rewrite
rule
F(X) -> V (F.getvalue)(X) -> V
I presume, much the same as java obviously has a rewrite rule for
automatically calling the getString method whenever some object
appears in a string-needing context, such as parameter to
system.out.Println, or operand to the operator that does string
concatenation, or the way C++ has a boolean-needing context such as
inside an 'if' statement which causes a boolean-producing method
instead of the default value-producing method, which is why
if(!cin) tests for EOF on stdin instead of null pointer (and why
if(cin) tests for not-EOF instead of non-null pointer).
The rewrite is built in to the compiler. I would say "not user
redefinable", but Pop11's pretty open; given enough effort you
can pretty much redefine whatever you like. More to the point,
you don't change any rewrite rules and you don't create any
macros when you define Pop11's updaters.

Well, I would simply say it's a single built-in (vendor-supplied)
macro so utterly powerful that no additional macros are needed by
ordinary Pop11 users so they don't miss the ability to define more
macros of their own. In essence it's the same as a macro, or
contrarywise a macro is really a rewrite rule by a different name.
Since the word "macro" has another entirely different meaning in
common language, namely "large", I'm thinking now that "rewrite
rule" is the better, more clear, jargon. Thanks for the enlightenment.
</OT>
 
R

Richard Tobin

There are only values, so if assignment assigns to something, it
must be a value.
[/QUOTE]
A value cannot exist unless it exists somewhere. There's no such
thing as just existing without being anywhere. The location where a
value exists is not itself a value, it's a place, a.k.a. location.

Is this a metaphysical theory or an assertion about C?

-- Richard
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Keith Thompson said:
I think the problem is that you seem to be writing your own
attribution lines. ...

I have to, or they wouldn't be there at all.
The standard form for attribution lines and quoted text is:

Any decent newsreader will do this for you automatically.

I don't have access to any such here.
<http://www.rawbw.com/~rem/NewPub/mySituation.html>
I do the best I can do with what's available here. If you don't
like how I do it, either hire me at a good enough wage that I can
pay off my credit-card debt and then have extra money left over to
buy a new computer that is capable of direct InterNet service, or
use the "any decent newsreader" you claim to be using to "killfile"
me so you'll never see anything I post and my slightly nonstandard
way of citing context won't bother you so much that you would
continue to harass me about it.
I'm posting this through a VT100 terminal emulator,

Hey, I thought I was the only person left still doing that!!
So why are you so nasty to me? You're the one person out there who
ought to understand the non-standard way I have to do things here.
but I'm able to download and view PDF files on the computer where
I'm running the emulator.

Do you happen to know where I can find a binhex of a Macintosh
version of a PDF viewer that requires less than one megabyte total?
(My hard disk is getting painfully full, can't afford more than
about one megabyte on any single addendum to what's occupying space
on hard disk. At the moment, total of 14.8 MB free on HD, and like
your mommy should have told you, "don't spend it all in one place".)
But perhaps you should try reading this:
...
| If you can't deal with PDF, search for "n869.txt"

I didn't see your article saying that until after I had already
done a Google search on a couple terms somebody else posted and
found it and downloaded:
WG14/N869 Committee Draft -- January 18, 1999
(1330770 bytes on Unix)
as I mentionned several times after you posted that while it was in
my backlog of articles not yet replied to. That looks like the same
file you're referring to. Anyway, I'm now trying desperately to
catch up with that backlog... I should have been to bed 3.26 hours ago.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: pete said:
If M and N are short integers,
then M+N is an expression of type int and not of type short.

Hmm, so you can do this:
short int M = MAX_SHORT_INT; (whatever the correct name is, DWIM here)
short int N = MAX_SHORT_INT;
int MPN;
MPN = M + N;
and MPN is guaranteed to have the correct value without short-int wraparound?
I suppose that's good to know. But on the other hand, int can in fact
be implemented as either long int or short int or anything between,
so unless you know that your implementation has int with at least one
more bit than short int, the above is all false, int might wrap around
because it's just short int on that implementation. So maybe that
is of no value, can't rely on any portable behaviour there, because
the size of int isn't portable.
If (M+N) overflows, then the result is undefined.

Ah, thanks for the enlightenment. Yes, I see now that's correct.
Let me check whether my CookBook/Matrix ever mentions either overflow
or wraparound ... OK I fixed the places where overflow is mentionned
in both CookTop.html and Matrix.html, so instead of saying it doesn't
check for overflow, now it says it doesn't necessarily check for
overflow, i.e. it might check or might not, and that the behaviour
is undefined. I kept in the remark about use of such functions (for
example atol) is not recommended, and now the reason is more clear.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Erik de Castro Lopo said:
ANSI is an American standard (not that there is anything wrong with
that :)) but since this is an international newsgroup, the
international ISO standard should probably take precedence.

You have a good point. I'll try to remember to refer to it as ISO C
despite the contrary notation in the GNU C compiler that I use
here. And where there's any ambiguity about *which* edition of ISO
C, I'll refer to it as ISO C1989 or ISO C1999 (the latter being
"ISO C" per the previous sentence).

Unfortunately I don't have access to any document defining ISO
C1989, and the only document for ISO C1999 is a draft version which
is alleged to differ from the actual standard in various unknown
ways. If somebody in this newsgroup knows those differences,
perhaps that person could post a Web page that I could use for
reference? Not just for me, for anyone needing the info, but at the
moment mostly for me.

What I *really* need is a plain-text version of ISO C1989, so I can
use that as a base for my CookBook/Matrix, since ISO C1999 isn't
yet fully implemented most (any?) places. Or maybe I should just
use the draft document as my base, with the caveat that both ISO
C1989 and ISO C1999 differ from it in various unknown ways? With
all the various standards and implementations that conflict with
each other, I'm thinking that writing portable C code really is
impossible, and I shouldn't worry about it, in particular shouldn't
waste time trying to make my CookBook/Matrix document exactly match
any hypothetical idea of "portable C code" per this or that standard.
How about "ISO C90 standard"?

Bad for two reasons:
- The ISO standard was published in 1989, not 1990.
- In the year 90, the Roman Empire was in control of Europe, and
the New World hadn't yet been discovered by my ancestors, and
people didn't realize that critical military systems would
remain non-functional for years after the y2k change, etc.

<OT>I wonder if the WTC bombing, as well as the faulty information
about WMD in Iraq, were both caused by software still not usable
after y2k, blinding our (USA) military as to what was really
happening?</OT>
 
F

Flash Gordon

Robert Maas, see http://tinyurl.com/uh3t wrote, On 24/03/07 17:56:

Unfortunately I don't have access to any document defining ISO
C1989,

<snip>

Only true if you choose to ignore the posts where a source has been
given and you also cannot be bothered to type in "c89 draft" in to
Google. Oh, and you also cannot be bothered to check your local library
to see what books they might have or be able to get.
Bad for two reasons:
- The ISO standard was published in 1989, not 1990.

Wrong. As you have already been told ANSI published it in 1989 and ISO
adopted it in 1990.
- In the year 90, the Roman Empire was in control of Europe, and

<snip more irrelevant stuff>

Do you seriously think there is some chance of confusion or are you just
being deliberately awkward?
 
R

Richard Heathfield

Robert Maas, see http://tinyurl.com/uh3t said:
Hmm, so you can do this:
short int M = MAX_SHORT_INT; (whatever the correct name is, DWIM
here) short int N = MAX_SHORT_INT;
int MPN;
MPN = M + N;
and MPN is guaranteed to have the correct value without short-int
wraparound?

No, because there is no guarantee that int is wider than short.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Flash Gordon said:
If you read the rest of the GCC documentation you will find one of two
things:
1) It tells you that it is referring to C89
2) It is a version pre-dating C99 which would therefore obviously not be
referring to C99.

I spent a long time reading/skimming all the way to the end of the
man pages, and saw no such information. I saw a reference to info
pages, so I tried info gcc, which put me into EMACS INFO mode with
no idea how to navigate it. It's been more than 20 years since I've
used EMACS INFO mode and I simply can't remember how to follow a
link there.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Mark McIntyre said:
You're pretty much making my point by this bollocks. the Bay Area may
be a postal region or tax region (for all I know) but its not a
geological region, nor yet a weather region.

You're definitely making my point, that for the C spec to simply
say that an lvalue is defined as something that specifies a region
but fails to say what kind of region, is not a specification at
all.
Apparently you're unfamilar with the meaning of yet another phrase...

What do you mean "the meaning"?? The phrease "clear its
neighborhood" could mean almost anything. It must have tens, maybe
even hundreds, of different meanings. No one of those many meanings
is "the meaning".
 
K

Keith Thompson

I have to, or they wouldn't be there at all.

Then can you at least do it *right*? Rather than manually typing
> From: Keith Thompson <[email protected]>

(or whatever mechanism you're using), you could manually type


The form of an attribution line can vary, but it should include the
poster's name and/or address, and it *shouldn't* start with ">" or the
word "From".
I don't have access to any such here.
<http://www.rawbw.com/~rem/NewPub/mySituation.html>
I do the best I can do with what's available here.

I believe you can do better.
If you don't
like how I do it, either hire me at a good enough wage that I can
pay off my credit-card debt
[snip]

Please read the article I posted recently with the "open classroom"
analogy. We can't do anything about your personal situation. There
are several billion people who are worse off than you are. After
we've helped all of them, perhaps we can get to you. There are
support groups out there; please find one rather than using
comp.lang.c to tell us about your personal problems.

[...]
Hey, I thought I was the only person left still doing that!!

I seriously doubt it.
So why are you so nasty to me? You're the one person out there who
ought to understand the non-standard way I have to do things here.

I'm not being nasty. I'm trying to be as helpful as I can. But if
you think I'm being nasty, then you're perfectly free to ignore me.
(No killfile is needed; just skip any article with my name on it.)
Please let me know if you decide to take this route, so I won't waste
my time offering you any more advice. (To be clear, I'm not being
sarcastic about this.)

There are plenty of decent newsreaders that run just fine on terminals
or terminal emulators. I use Gnus, which runs under Emacs; others
include tin, nn, pine, trn, slrn, and even the ancient rn.

Perhaps your situation doesn't allow you to use any of them, but you
might consider looking into it. (I think you said you dial into a
Unix system; I'd be surprised if it didn't have some newsreader
available.)
Do you happen to know where I can find a binhex of a Macintosh
version of a PDF viewer that requires less than one megabyte total?

Not a clue. Try asking in a Macintosh newsgroup, or doing a Google
search.

[...]
 
K

Keith Thompson

Erik de Castro Lopo <[email protected]> writes:

[attribution line fixed]
Bad for two reasons:
- The ISO standard was published in 1989, not 1990.

No, the ISO standard was published in 1990.
- In the year 90, the Roman Empire was in control of Europe, and
[snip]

I understand the point, and I also prefer to represent years in 4
digits whenever possible. But in this case, there is a nearly
universal existing convention to refer to the various standards as
"C89", "C90", and "C99". Calling them "C1989", "C1990", and "C1999"
does not increase clarity (nobody is going to think the ancient Romans
had a standard for the C programming language). In fact, I find the
names "C90" and "C99" more visually distinct from each other than
"C1990" and "C1999". If you're interested in being understood, I
encourage you to use the 2-digit forms.
 
F

Flash Gordon

Robert Maas, see http://tinyurl.com/uh3t wrote, On 24/03/07 21:09:
Why are you still insisting on putting "> " before the attribution line
when you have had multiple requests not to? Are you *trying* to make it
harder for everyone else? The request is for you to do *less* typing, so
you can't complain we are trying to make you do more work. Your method
tells people that it was my asking whether the GNU C MAN pages are
referring to C99 and some unknown person answering, when in fact it was
me doing the answering and you asking.
I spent a long time reading/skimming all the way to the end of the
man pages, and saw no such information. I saw a reference to info
pages, so I tried info gcc, which put me into EMACS INFO mode with
no idea how to navigate it. It's been more than 20 years since I've
used EMACS INFO mode and I simply can't remember how to follow a
link there.

The gcc documentation includes info pages, if you don't read those then
you can't claim to have looked through the documentation. I found it
easy enough to find out how to use info, info unsurprisingly enough
comes with documentation on how to use it. Or you could read the
documentation in the obvious place on the web.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Keith Thompson said:
Ok. You need to be aware, though, that a lot of people use the
term "ANSI C" to refer to the language defined by the 1989 ANSI
standard. Which is why I refer to "C90" or "C99", to avoid the
potential ambiguity.

Yeah. Earlier postings have convinced me of that ambiguity indeed.
(I'm still desperately trying to catch up with my backlog.)
Or whatever the GNU C compiler uses when the -ansi switch is turned
on. From the man pages here:
[snip]
gcc's "-ansi" option is equivalent to "-std=c90" or
"std=iso9899:1990". (I've suggested that "std=c89" should also
be accepted.) So, as you can see, the term "ANSI C" is ambiguous.

I wasn't able to find that in the man pages. Let me quote exactly
what I see there:

-ansi Support all ANSI standard C programs.

This turns off certain features of GNU C that are incompatible
with ANSI C, such as the asm, inline and typeof keywords, and
predefined macros such as unix and vax that identify the type of
system you are using. It also enables the undesirable and
rarely used ANSI trigraph feature, and disallows `$' as part of
identifiers.

The alternate keywords __asm__, __extension__, __inline__ and
__typeof__ continue to work despite `-ansi'. You would not want
to use them in an ANSI C program, of course, but it is useful to
put them in header files that might be included in compilations
done with `-ansi'. Alternate predefined macros such as __unix__
and __vax__ are also available, with or without `-ansi'.

The `-ansi' option does not cause non-ANSI programs to be re-
jected gratuitously. For that, `-pedantic' is required in addi-
tion to `-ansi'.

The preprocessor predefines a macro __STRICT_ANSI__ when you use
the `-ansi' option. Some header files may notice this macro and
refrain from declaring certain functions or defining certain
macros that the ANSI standard doesn't call for; this is to avoid
interfering with any programs that might use these names for
other things.

I've looked over that text several times, and even did a search
after loading it into a text editor, and I still don't see it say
what you are saying, not a single mention of 89 or 90 anywhere
there. Apparently the man pages on your system are better in this
respect than the man pages on this ISP shell account I'm using.

In any case, I'm thoroughly convinced "ANSI C" is too ambiguous for
my purposes.
The gcc documentation refers to C89 when it discusses the "-ansi"
option.

What documentation are you referring to? Not the 'man' pages here!!
Or you could call it "ANSI C89".

Somebody just before you pointed out that this is an international
newsgroup and I should use the ISO designation instead of the ANSI
designation. And to be y2k safe, I'll use the full four-digit year.
Not quite. ANSI issued a C standard (the first one) in 1989. ISO
adopted it, with some non-substantive changes, in 1990; ANSI then
adopted the 1990 ISO standard as an ANSI standard.

OK, I'm just going to take your word for that, you anonymous person
I've never met who is posting from some unknown IP number
(apparently part of RoadRunner ISP, which fails to include the NNTP
posting host like most other ISPs do), because I don't have any
more energy to check facts myself. So it's now ISO C1990 in my book.
I don't remember where your Matrix is.

<http://cbfalconer.home.att.net/download/n869_txt.bz2> is a
compressed (with bzip2) plain-text draft.

Ah, so it's *not* plain text, it's compressed with a nonstandard
compressor which confuses lynx (and me, using lynx to view it).
From a different source I downloaded:
WG14/N869 Committee Draft -- January 18, 1999
Is that the same as the bzip2-compressed document you cited? If so,
then I guess this search-for-plain-text-standard is nearly
finished, still no plain text of the actual standard (neither 1990
or 1999), but this draft pretty close to ISO C1999.
n1124.pdf is what I use. Adobe Reader is able to translate it to
plain text. The result isn't as nicely formatted as n869.txt,
but it has the advantage that it includes the full C99 standard
plus the two Technical Corrigenda.

That might be useful.
I already offered to send you a copy; you'll need to contact me
and let me know how to get it to you (compressed? if so, how?
e-mail? ftp? www?).

If you e-mail as an attachment (gzip preferred if not plain text),
be sure to go to my Web site to see what keyword has to be in the
Subject field so I'll arrive separated from the
hundred-spam-per-day so I'll ever see it.

If you make it available by FTP or HTTP, you can post the URL
either in the newsgroup, where I may or may not discover it via
Google search, or e-mail the URL with the Subject-field tag to
separate it from spam.
Most of us find the PDF version sufficiently useful.

Most of you have enough income to be able to afford a new computer
every several years and live PPP access for each such computer. My
current computer was already very old when I bought it used in
1998, but it was all I could afford, and currently I would't be
able to afford even it, so it's good that I bought it when I did or
I'd be totally without computer ever since mid-1999 when my even
older Mac Plus died.
 
G

Gregor H.

...nobody is going to think the ancient Romans had a standard for the C
programming language.
Well, this may be true. On the other hand it's a historical fact that "one of
the main causes of the fall of the Roman Empire was that, lacking zero, they
had no way to indicate successful termination of their C programs." :)


G. H.
 
C

CBFalconer

Flash said:
.... snip Maasive sobs ...

The gcc documentation includes info pages, if you don't read those
then you can't claim to have looked through the documentation. I
found it easy enough to find out how to use info, info
unsurprisingly enough comes with documentation on how to use it.
Or you could read the documentation in the obvious place on the web.

Or he could do as he is prompted at the initial window, type '?'
and get an introduction to the system. However I suspect he would
rather cry about it.
 
R

Robert Maas, see http://tinyurl.com/uh3t

From: Richard Heathfield said:
... you can get text conversions, but you tend to lose some
important format information (e.g. subscript and superscript info
is lost,

If it was ever there in the first place, why would it be lost except by
a cruddy text converter??
so you see sillinesses such as 232 - 1 on occasion).

That looks like a bug, or super-lazy algorityhm, not an inherent
limitation of the task.
or you're saying you don't recognise bzip2 format.

I never heard of bzip2 before. Lynx never heard of it either,
passes it verbatim to the VT100, which results in garbage. I
checked, and bzip2 is in fact available here on the Unix shell
machine, so if I ever really need such a file I can short-circuit
lynx to download it and then manually decompress it.
You can do it yourself, using bunzip2. Furrfu.

Yeah, I know that now, after reading the man pages here.
 

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,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top