Re: How to convert Infix notation to postfix notation

On Nov 6, 2:05 pm, Seebs <usenet-nos...@xxxxxxxxx> wrote:
(READER NOTE:  There is actual content about C in this one, just for variety.)

On 2009-11-06,spinoza1111<spinoza1...@xxxxxxxxx> wrote:

This is
of course that
(1) Functions must be defined before use (an idiot language feature
since it is an artifact of the thrilling days of yesteryear when
storage was limited, and programs were on paper tape and could not,
conveniently, be read more than once)

You're gonna have to work harder on learning the terminology if you want
to discuss C and not just be laughed at.

This is your anxiety. You're anxious to avoid being laughed at as you
were when you were young, because unlike me, in all probability, you
did not stand up to the bully and fight like a man, which is what we
did in 1964. You need to grow up, and read Habermas: enlightened
discussions between MEN avoid as much as possible "terminology", which
is a modern form of the Hebrew "shibboleth", the use of pronunciation
in the Old Testament to tell friend from foe.

Functions must be *declared* before use.  The thing with a function body
is a definition, the one without a function body is a declaration, also
called a prototype.

You also don't understand the intent or purpose of the feature.  You're
unlikely to even if it's explained, because you seem to have attained
a nearly supernatural level of willful blindness to even the most trivial
facts, but we have other readers.

This is just silly. I have told you to restrict yourself to C because
you don't understand programming. When you tell me things I already
know, you're wasting my time.

Q:  Why doesn't C just read the whole file to find a function's definition?

A:  Because prototypes would be needed anyway.

C is designed to support genuinely modular code -- you can build a program

OK, this is better, but I'm afraid you're wasting my time nonetheless,
because 50% of the effort here is needed to preserve legacy, and the
answer is: eliminate C.

which incorporates functionality that was previously compiled.  That means
that you can, on nearly all implementations, build a program which includes
pieces of code for which you have *no source code*.  The solution adopted
in early C was to allow declarations of external functions which are used
to generate code to call those functions even if no definition for that
function exists in source code.  In C89, this feature was extended (based
in part, as I recall, on the C++ prototype feature) to include "prototypes"
which provide declarations of the arguments, not just the return types,
of the function.

Prototypes are primarily used to address the fairly common case where the
function being called is defined in a separate "translation unit" (in most
cases, this means "source file", but there are technical differences).

At the time, it made sense to allow compilers to continue to, at least in
principle, be able to operate in a single pass.  While that's less crucial
now perhaps than it used to be (as most modern optimizers end up needing
to work with everything in memory for a while), it's still considered a
plus for vendors targeting smaller systems.  (In a fit of irony, Microsoft
systems were one of the targets that benefitted a lot from this, but of
course, they're not important.)

Since prototypes are already needed, and well-defined, the language just
expects you to provide them whenever you call a function before its

All of this legacy nonsense has one solution: OO.

(2) Fixing this problem (which is an iinsult to the intelligence)

In normal English, "an insult to the intelligence" isn't supposed to be
a precise synonym for "which is reasonable for reasons I don't understand",
but I guess I've gotten used to your diaect.

in the ordinary way means coding the declaration twice.

Or using functions only after their definition.

If you know a better way to fix the problem, what is it?

The canonical solution is, in fact, to declare the function once and
define it once, usually with the declaration in a header if it's going
to be used by or seen by other translation units.

Yes indeed.

However, the distinction between declaration and definition, like
sequence points, is not a reputable construct. It's a patch which
corrects the blunders and limitations of the past.

It's asking for trouble to have an intermediate level of definition. A
code resource is either available or else it isn't.

I see it in my GUI: in C Sharp, I can click only on the definition,
and on C I have the choice of def and decl which is a stupid and
confusing waste of time...but as you say necessary...because C is
fucked up.

You need to actually learn a radically different programming language.
Your uncritical "expertise" in mistakes doesn't impress me.

My way gives a nice little overview and is reasonably easy to

The regular way is pretty easy to maintain if your prototypes don't change
too often, and if they change too often, they're changing too often.

Copyright 2009, all wrongs reversed.  Peter Seebach / usenet-nos...@xxxxxxxxxxxxx://<-- lawsuits, religion, and funny pictures <-- get educated!