callback function

K

Keith Thompson

Bill Cunningham said:
One thing is clear in clc. C expert, computer programmer, nothing
to do but program ->ingroup. Don't know C, ask questions about it,
other things to do than program or *don't understand* there's a biggy
->outgroup. Possibly to the point of plonk by the ingroup. The
ultimate outgrouper.

Nonsense. Consider how much time and effort people here have spent
trying to answer your many questions.
 
B

Bill Cunningham

Keith said:
Nonsense. Consider how much time and effort people here have spent
trying to answer your many questions.

You maybe Keith and a couple of others. I will try not to post code
unreadably anymore even if untested like the other day. That was 1-2%
laziness and the rest not knowing anything about indentation. I always use
indent and it works great. I don't indent myself. But back to the subject I
have seen some answer other's questions and I've asked the same question and
they complain and tell me to get a book or I should already know something.
It might be lack of patience on their part because I know when dealing with
me it takes patience.

Bill
 
B

Bill Cunningham

Barry said:
Since changing a string literal is prohibited, you are doomed before
you start.

[snip]

Then why use const char * ? FWIW IMO they should remove the const qualifier
from the standard. Something isn't just going to change use there's code to
change it. Why use const?

Bill
 
I

Ian Collins

Yes I understand. I am just expressing the opinion like those in the
*in* group that you can just not change it. I think it's a waste to the
standard personally. FWIW.

What is a waste, const? It certainly is not. Just consider the case
where the data pointed to is in read only memory.
 
I

Ian Collins

Besides I thought untested code was enough in answering my questions. I
planned on testing it and have.

And let me ask you as a programmer Ian and being in the *in* group an
*outgroup*er question.

What on earth is the in group? Did I pay a fee, compete a right of
passage or accept a nomination?
What exactly do callback pointer functions help with.

What exactly is a "callback pointer function"?
I know this should come from the womb but just and honest question.

You have already demonstrated a use for function pointers in your example.
 
B

Bill Cunningham

Ian said:
What on earth is the in group? Did I pay a fee, compete a right of
passage or accept a nomination?

Those who run clc. Top C programmers who know C well enough to decide
whose worthy to learn. Never ask a question but answer those want to learn,
if found worthy and decide who is or isn't plonked and put into the
outgroup.

question: "How does a linked list work in C ?"

asked by a and b. (newbies to comp science)

ingrouper a explains to newbie a a linked list.
ingrouper a tells newbie b to piss off.
ingrouper a tells ingrouper b to plonk newbie b and does
so himself.
ingrouper b says "why plonk"
ingrouper a says "I said so".

See the hierarchy in ingrouper a and b? b listens to a .
 
B

Bill Cunningham

Bill said:
Those who run clc. Top C programmers who know C well enough to
decide whose worthy to learn. Never ask a question but answer those
want to learn, if found worthy and decide who is or isn't plonked and
put into the outgroup.

question: "How does a linked list work in C ?"

asked by a and b. (newbies to comp science)

ingrouper a explains to newbie a a linked list.
ingrouper a tells newbie b to piss off.
ingrouper a tells ingrouper b to plonk newbie b and does
so himself.
ingrouper b says "why plonk"
ingrouper a says "I said so".

See the hierarchy in ingrouper a and b? b listens to a .

Now an outgrouper such as myself may not necessarily be in "everyones"
killfile but if your in a killfile you in the outgroup. I'm not a newbie
either. A troll or even suspected troll has the honor of the outgroup title
also. Or someone simply who "asks the wrong questions".
 
B

Barry Schwarz

Barry said:
Since changing a string literal is prohibited, you are doomed before
you start.

[snip]

Then why use const char * ? FWIW IMO they should remove the const qualifier
from the standard. Something isn't just going to change use there's code to
change it. Why use const?

Do you really think the standard should be changed because your
limited understanding of the language does not provide you an obvious
use of the qualifier?
 
N

Nick Keighley

    That's fine John I appreciate your opinion though yes you where wrong.
No problem. But be forewarned, this *could* be the start that leads you to
the *outgroup* If you start asking questions especially you should know as a
computer programming expert (ingroup) and sticking yourself out there...Be
careful.

If you're going to talk crap could you confine yourself to the C
language, as you usually do?
 
N

Nick Keighley

Besides I thought untested code was enough in answering my questions. I
planned on testing it and have.

    And let me ask you as a programmer Ian and being in the *in* group an
*outgroup*er question.

could you stop this in/out group nonsense?
What exactly do callback pointer functions help with.
I know this should come from the womb but just and honest question.

how would you implement qsort without using function pointers? How is
qsort to do a comparison of an arbitary type?
 
B

blmblm

Why do some people post untested code? I didn't know it was against the
rules. I've seen it alot. It's tested now and works perfectly.


Consider two scenarios:

Person X posts untested code and asks for help with it.

Person Y posts untested code in response to a question or request for
help.

Can you really not perceive a difference between these two situations,
one that doesn't involve "in" and "out" groups?


Aside, not just to you: I'm always amused by claims that code "works
perfectly". "Works for all the tests I tried", okay, but -- oh well,
I suppose I'm just a pessimist? It does seem like only relatively
inexperienced programmers make such claims.
 
B

blmblm

On 10/25/2012 6:01 AM, (e-mail address removed) wrote:
[...]
Aside, not just to you: I'm always amused by claims that code "works
perfectly". "Works for all the tests I tried", okay, but -- oh well,
I suppose I'm just a pessimist? It does seem like only relatively
inexperienced programmers make such claims.

Well, I have no problem believing the "works for all tests I tried" claims.

Except the beginners don't seem to say it that way, do they? they say
something works "perfectly" or "flawlessly". Cynic that I am, I'm
inclined to agree with your comment:
I just don't believe that their test suite was very extensive.

"No, I never tried entering 'antidisestablishmentarianism'. Why do you ask?"

"No, I never tried entering 12345678901234567890. Why do you ask?"

"No, I never tried passing a negative number. Why do you ask?"

Indeed.
 
R

Robert Miles

I have these 3 functions and before I compile I am going to ask about
them. This is for qsort. I tried to tackle this once and couldn't get it I
think I get it now. I don't like const's. They are a nuisance. You can't
directly pass string literals to them you want to change. Maybe that's just
the way C is though.

const is intended to be used for items with values known at compile
time that do not need to be changed as the program runs. Looks like
you aren't trying to use it that way, and are therefore having
problems with anything you declare const.
 
R

Robert Miles

Barry said:
Since changing a string literal is prohibited, you are doomed before
you start.

[snip]

Then why use const char * ? FWIW IMO they should remove the const qualifier
from the standard. Something isn't just going to change use there's code to
change it. Why use const?

Bill

Correct C code will not try to change it. Do you want to remove the
ability of the C compiler to find and report incorrect C code that
does try to change it?
 
M

Malcolm McLean

On 10/17/2012 4:16 PM, Bill Cunningham wrote:

const is intended to be used for items with values known at compile
time that do not need to be changed as the program runs. Looks like
you aren't trying to use it that way, and are therefore having
problems with anything you declare const.
That's one use. A more common use is to document that a function doesn't
change data.
Eg
char *stripspace(const char *str)
indicates that the function is likely to return a pointer to a stripped
string, rather than strip it in place.
 
K

Keith Thompson

Robert Miles said:
const is intended to be used for items with values known at compile
time that do not need to be changed as the program runs. Looks like
you aren't trying to use it that way, and are therefore having
problems with anything you declare const.

const doesn't mean that something's value can be determined at
compile time. It merely means read-only.

This:

const int r = rand();

is perfectly valid (at block scope, anyway).
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top