Help a beginner - simple lowercase to uppercase and so on function

A

Antoninus Twink

(e-mail address removed) said:

Too much, perhaps? Not that there's a limit, but for your own
benefit it may be better to think more and post less.

Physician, heal thyself.
Better to stop, think, and think again.

"Indeed".
 
A

Antoninus Twink

bartc said:

I'm not attacking him. I'm trying to help him.

Sure, Heathfield.

Like you don't attack Jacob, do you? You "just try to help him". Of
course.

If it has a tail and barks, you can't blame Bart for calling it a dog.
 
A

Antoninus Twink

spinoza1111 said:

...and that's a lie.

Really? It would certainly fit with your christian fundamentalist
beliefs.

We know that you're an anti-semite, but I'd be interested to see the
evidence of your homophobia.
 
A

Antoninus Twink

jacob navia said:

Maybe you can't, but I can - by setting a breakpoint at an
appropriate place and making a note of the value before the mod.

Great, Heathfield.

It is clear that Jacob was referring to debugging from a core file, but
as usual you deliberately misinterpret what he was saying.
 
P

Phil Carmody

Dik T. Winter said:
What is the sense of using '&' with a non-const parameter in C?

What does that even mean?

(I come from a school that differentiates between arguments and
parameters. I suspect that different interpretations of the words
may lead to different evaluations of the above, but would rather
not delve into such perversities unguided.)

Phil
 
P

Phil Carmody

bartc said:
OK, more like this then:

void intcopy(int *originaldeststart, int *originalsourcestart, int term)
{
while((*originaldeststart++ = *originalsourcestart++) != term) {}
}

Yeah!

Don't do that.

I'm glad we're all finally agreed on something.

Phil
 
K

Keith Thompson

Phil Carmody said:
What does that even mean?
[...]

I think spinoza1111 is advocating the use of reference parameters,
and not realizing that they exist in C++ but not in C.
 
S

spinoza1111

...
 > > What is the sense of using '&' with a non-const parameter in C?
 >
 > Clarification: I meant a non-const parm not declared using the inverse
 > operator *, but it was pretty obvious what I meant. Part of the
 > problem, and I've said this before, is that Ritchie designed-in some
 > fairly perverse thought patterns in order to be cute as a member of a
 > protected technical caste.

Value parameters that act as local variables is not entirely newly thought
off by Ritchie...

No, he had twenty years of bad practice to draw upon: weekend hippie
programmers who thought they were being clever.

Suppose you want to run your C source code on a machine, on whose
stacks the parameters are read-only. For whatever reason, you can only
modify your local variables.

I don't know whether such a machine exist but it could.

Modifying a parameter on the stack is to assert in a hidden fashion
that "I have access to the stack for modification, and I know it".

Hidden assertions are bugs waiting to happen.
 
S

spinoza1111

What does that even mean?

[...]

I thinkspinoza1111is advocating the use of reference parameters,
and not realizing that they exist in C++ but not in C.

These tiresome verbal quibbles are the stock in trade
Of fat bearded and pompous men, who then pretend
That their roteish knowledge of words and words only, their pedantry,
Is true knowledge. Passing by reference in C
Is passing an address by value, and is oft distinguished
By calling it passing by reference. But Fat Bastards
And other dastards of the data processing tribe,
Like to interrupt conversation between friends
And destroy even the semblance of comitious amity
Replacing it by frowns, hard looks and contumacious contumely,
And this is why they pretend to be so fussy about terminology.
They question credibility with no necessity, and men defend themselves
'Gainst such vile reproach as is natural, men not being elves,
Sprites that can turn aside and shyly flee to forest wide.
Dolt, I have long forgot more C than thou shalt ever see
Fool, I have gained wisdom enow for its usage to eschew.
Creep, my use of words deceivest thou thy dull villain's brain:
Pedant, thy open and knavish tricks I hereby do disdain.
Ape, keepst thou thy paw from response:
Snake, crawls't away whilst thou livest for this nonce.
I was passing gas by value coding parms before thou wast born:
I was referencing inversely to asterisk when men did thee as infant,
scorn.
Call me by reference, call me by name,
Call me what name thou wilt, you'll me not shame:
Call me by value, caitiff, and make an end
Thee thy Sophist's words to wisdom only pretend.
 
S

spinoza1111

Really? It would certainly fit with your christian fundamentalist
beliefs.

We know that you're an anti-semite, but I'd be interested to see the
evidence of your homophobia.

Let's drink a toast the Antoninus Twink
He's nailing Heathfield. Buy the man a drink.
 
P

Phil Carmody

Keith Thompson said:
Phil Carmody said:
What does that even mean?
[...]

I think spinoza1111 is advocating the use of reference parameters,
and not realizing that they exist in C++ but not in C.

Oh gawd. I think you're right. That's just plain sad.

Phil
 
S

spinoza1111

spinoza1111said:




On such a machine, the implementation would be required by the
Standard to find somewhere else other than a stack in which to pass
parameters.
Oooooohhh the Standard.
Taking the stack out of the equation, since C doesn't require one:

Modifying a parameter is to assert that one may modify parameters. The
C Standard supports this assertion.

Reason not the need, like Lear?

Mathematically speaking, you never need to either modify the values of
parameters that are accessible to the callers, and you never need to
re-use the space occupied by value parameters by overwriting them with
your own silly values.

In the first case, in an object oriented language, you always have the
ontological choice to declare a new Thing which includes things. It
has long been trivial to "wrap" > 1 value in structs in C, and if I
were a nasty person like you, I'd of course now be claiming, falsely,
that you don't know structs.

But I'm not a nasty piece of work, like you. You know structs but
somehow when you claimed that you need to alter the values of
parameters passed "by reference" (prefixed with asterisks) you forgot
about structs. This is called a brain fart, and the charter of this ng
needs to be amended, calling for any poster, who exagerrates brain
farts, Malapropisms, incorrect "terminology" and other aporias into
libelous claims that the neurologically flatulent, the Malaprop, the
users of incorrect words, and the rest of the Aporiites are globally
incompetent, to be shunned.

Furthermore, you don't see that the more assertions a program depends
upon the unsafer it is, not only in the groves of academe but also in
the real world, such as that chip shop you infest. Occam's Razor is in
Fluellen's words an excellent moral, and it applies more to
propositions than to things.

Good programmers do ontology. Instead of relying on mythological
knowledge they see that (for example) a function's normal return and
its "error code" form mathematically speaking the single value of the
function.

Bad programmers instead pride themselves on knowing a lot of rote
detail and lust to impose this rote detail on others.

So: don't use value parms as notepaper. Create a local variable like a
normal person and either name it after its purpose, or if you must use
it in different ways in different areas of your code, call it after
its overall function. I like intIndex1/2 ... n in memory of the
limited set of index registers on second generation machines.
There's nothing hidden about it. See ISO/IEC 9899.

Wow, soon to be a major motion picture. The C Standard. Featuring Herb
Schildt taking your girl while you hold his ball.
 
S

spinoza1111

spinoza1111said:







If by "nailing" you mean "lying about", perhaps. I have no idea why he
ascribes either anti-Semitism or homophobia to me, but it's simply
false, like much that he says about me. It's about as accurate as
your own claims that I'm a Nazi working for MI5.

Your conduct (spreading rumors about people) is isomorphic to anti-
Semitic conduct in the sense that its structures are the same. You
also delight in making sure that posters fall to blows rather than
become friends, and this is due, I believe, to homophobia.
 
S

spinoza1111

Keith Thompson said:
Phil Carmody said:
<38bd29e0-d231-4b76-a16d-e6b7cd0c4...@y10g2000prf.googlegroups.com>
 > Using a non-const parameter without & is like the consultant who
 > borrows your watch to tell you the time, and walks away with the
 > watch.
What is the sense of using '&' with a non-const parameter in C?
What does that even mean? [...]

I thinkspinoza1111is advocating the use of reference parameters,
and not realizing that they exist in C++ but not in C.

Oh gawd. I think you're right. That's just plain sad.

(Sigh). The value of the address is on the stack. So it's to the
literal minded incompetent a call by value. However, the value of the
address is easily "dereferenced" using, if memory serves...wait
a...minute...oh yes, asterisk (god forbid Ritchie should use English).

All parameters are passed in C "by value" in that sense alone. But if
that were the only sense, then call by reference in any runtime that
uses a stack would involve the absurd algorithm of "moving" the byref
value to the stack, somehow destroying its original "version", letting
the subroutine do its wicked will, and then moving it back.

Some idiot may have done this. Some foul troll.

Of course, by reference calling in a programming language is SUPPORTED
by passing the address by value. I am surprised you don't know this.
Gee, you're probably incompetent and a pedophile (when in Rome...).
 
D

Dik T. Winter

>
> No, he had twenty years of bad practice to draw upon: weekend hippie
> programmers who thought they were being clever.

The Algol 60 report is quite clear about it.
"4.7.3.1. Value assignment (call by value). All formal parameters quoted
in the value part of the procedure declaration heading are assigned the
values (cf. section 2.8. Values and types) of the corresponding actual
parameters, these assignments being considers as being performed
explicitly before entering the procedure body. The effect is as though
an additional block embracing the procedure body were created in which
these assignments were made to variables local to this fictitious block
with types as given in the corresponding specifications (cf. section
5.4.5). As a consequence, variables called by value are to be considered
as nonlocal to the body of the procedure, but local to the fictitious
block (cf. section 5.4.3)."

And who of J.W. Backus, F.L. Bauer, J. Green, C. Katz, J. McCarthy, P. Naur,
A.J. Perlis, H. Rutishauser, K. Samuelson, B. Vauquois, J.H. Wegstein,
A. van Wijngaarden or M. Woodger are the "weekend hippie programmers"
avant le lettre?
> Suppose you want to run your C source code on a machine, on whose
> stacks the parameters are read-only. For whatever reason, you can only
> modify your local variables.

Well, apparently the people mentioned above gave clear semantics...
> Modifying a parameter on the stack is to assert in a hidden fashion
> that "I have access to the stack for modification, and I know it".

Wrong. See the semantics above.
 
D

Dik T. Winter

> Of course, by reference calling in a programming language is SUPPORTED
> by passing the address by value. I am surprised you don't know this.

There is one more thing needed to support it. Within the body of the routine
there should be no distinction whether a parameter is by reference or by
value, accessing its value should be the same.

Or do you assert that C also has call by reference to reference, ad
infinitum?
 
S

spinoza1111

spinoza1111said:







Yes, the Standard. In this case, as in a great many cases, a knowledge
of the Standard means that we don't have to run from chimerae such as
"not having the right to modify parameters", because the Standard
explicitly gives us this right, and therefore we know we can do this
provided we are using a conforming implementation.

Yeah, the standard is a big fat help when you're using a non-
conformant compiler. Non-conformant compilers are Legion, but we can
always defraud the user by saying that our non-working code is
"standard".
That appears to be a non sequitur. If we need to modify parameters, we
can do that. If we /wish/ to modify parameters, we can do that. If we
choose not to modify parameters, we can refrain (and employ the
assistance of the language in preventing us from doing so
accidentally).
Remind me never to pass you any parameters. I don't want you munging
even copies I never see. It makes me ill to think of your clunky code
destroying the values I have passed to you. When your code crashes as
it probably does, I don't want to simultaneously have you whine that
it is standard and thus bug-free, and try to recover what I sent you.

I will never, not in a million years, give you a job if I am in a
position to do so, and I will refuse any job offers from you. Aren't
you glad we've cleared this up?

Dijkstra said somewhere that a good programmer has good taste, unlike
Charlie the Tuna what tasted good.

Programming on purpose means not messing around, and programmers who
think that it shows intelligence to mung parameters not intended to
be munged are messing around and showing off. I don't care if they are
"Dennis Ritchie".
Ignoring "silly", it is true that you never /need/ to modify parameter
values, because it's possible (and indeed easy) to make copies and
modify the copies. It is nevertheless sometimes clearer to modify
parameter values than to modify copies thereof, and clear code pays
dividends when it comes to maintaining the program.

The incompetent programmer is among other things prone to profoundly
narcissistic reasoning. He reasons that what is clear to him at the
time is Clear for all time.
Perhaps you would care to support this assertion with a message ID.

Do your own homework, or sue me.
If it happened (and if you interpreted it correctly, which is
unlikely).


This newsgroup has no charter.

Lucky you
The Standard makes certain guarantees on which a programmer can rely
if he (or she) is using a conforming implementation (and makes
further guarantees for those using conforming hosted
implementations). If you are not using a conforming implementation,
then you cannot rely on such guarantees. This is surely obvious.

This is absurd. To say that a programmer should be held harmless for
the mess he makes (such as destroying the value of parameters in such
a way as to make a program hard to debug when it crashes near its end)
because he's "conformed" to the standard is weasel-assed reasoning. To
depend on a maximal set of assertions in a situation of uncertainty is
foolishness.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top