Discussion:
what's a callback?
(too old to reply)
John Larkin
2004-12-19 20:09:55 UTC
Permalink
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.

I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."

John
Hans-Bernhard Broeker
2004-12-19 20:20:59 UTC
Permalink
[F'up2 cut down --- should have been done by OP!]
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions?
It's actually quite an established term in software API design, and it
means quite the same as its origin did in the realm of telephones: you
pass someone a number under which he should call you back, if
something particular happens. In computers, that number is usually
the address of a function.

The canonical example of a callback function is a comparison function
passed to a generic sorting routine like qsort() in the C standard
library: you pass this information to qsort(), and whenever qsort()
needs to know which of two elements is larger, it'll call back your
application under this address to find out.

In more en-vogue terms of software design, the callback is the
procedural programmer's way of implementing what the OO guys call an
observer pattern.
Post by John Larkin
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
It doesn't. That's just a flag.
--
Hans-Bernhard Broeker (***@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Spehro Pefhany
2004-12-19 20:54:38 UTC
Permalink
On 19 Dec 2004 20:20:59 GMT, the renowned Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
It doesn't. That's just a flag.
It's got to at least be a static flag, maybe more if the ISR is
designed to be re-entrant.


Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
***@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
John Larkin
2004-12-19 21:52:08 UTC
Permalink
On Sun, 19 Dec 2004 15:54:38 -0500, Spehro Pefhany
Post by Spehro Pefhany
On 19 Dec 2004 20:20:59 GMT, the renowned Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
It doesn't. That's just a flag.
It's got to at least be a static flag, maybe more if the ISR is
designed to be re-entrant.
This is bare-metal assembly on a single-chip uP without MMU.
Everything's global, and everything's static. The isr runs
periodically at about 10 KHz, and just runs straight through to
completion every time, with some simple state flags to direct its
path. There's a block I *should* run every 5th time, but if something
more important needs to be done (namely collecting some energy
readings every time a laser fires) I set a flag to remind me to do the
deferred stuff some later pass.

Thanks to all for the "callback" explanation.

John
Genome
2004-12-20 01:07:06 UTC
Permalink
Post by Hans-Bernhard Broeker
--
Even if all the snow were burnt, ashes would remain.
You haven't got a fucking clue.......

Go on prove me wrong.

DNA
CBFalconer
2004-12-20 05:37:27 UTC
Permalink
Post by Genome
Post by Hans-Bernhard Broeker
--
Even if all the snow were burnt, ashes would remain.
You haven't got a fucking clue.......
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
--
Chuck F (***@yahoo.com) (***@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Frank Bemelman
2004-12-20 07:58:36 UTC
Permalink
Post by CBFalconer
Post by Genome
Post by Hans-Bernhard Broeker
--
Even if all the snow were burnt, ashes would remain.
You haven't got a fucking clue.......
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
Which reminds me that you never posted *never* anything brilliant
or intelligent. Stuff your hot potatoe. PLONK.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Anthony Fremont
2004-12-19 20:26:28 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'd say that it's usually used when you have some kind of OS running.
You often specify the address of a routine to be executed when some kind
of I/O is complete. The OS automatically invokes the "callback" routine
when whatever was being waited on is complete.

An interrupt handler might be deemed a callback routine, but I tend to
think of callbacks as being more of a one-off type of thing.
Post by John Larkin
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
I would call that a semaphore. (actually, I would call it a switch or a
flag; someone with more professional education, or someone in personnel
might call it a semaphore ;-)
Spehro Pefhany
2004-12-19 20:43:11 UTC
Permalink
On Sun, 19 Dec 2004 12:09:55 -0800, the renowned John Larkin
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
AFAIUI, a callback handler is essentially like asychronous logic- it's
a routine (that you register with some other piece of software) that
gets called when some specific set of conditions arise.

The business of sharing resources between threads in a threaded
environment (where you can, for some purposes, pretend that the
computer is executing multiple bits of software simultaneously) is
fairly complex and involves a lot of fairly odd terminology (mutex,
semaphore etc.) Most of my stuff doesn't have an RTOS so neither the
facilities or the complexity are there.


Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
***@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
John Larkin
2004-12-19 21:54:07 UTC
Permalink
On Sun, 19 Dec 2004 15:43:11 -0500, Spehro Pefhany
Post by Spehro Pefhany
The business of sharing resources between threads in a threaded
environment (where you can, for some purposes, pretend that the
computer is executing multiple bits of software simultaneously) is
fairly complex and involves a lot of fairly odd terminology (mutex,
semaphore etc.) Most of my stuff doesn't have an RTOS so neither the
facilities or the complexity are there.
Little ticktock state machines can be very powerful in the right
circumstances. And very reliable.

John
Active8
2004-12-21 16:48:55 UTC
Permalink
Post by Spehro Pefhany
On Sun, 19 Dec 2004 12:09:55 -0800, the renowned John Larkin
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
AFAIUI, a callback handler is essentially like asychronous logic- it's
a routine (that you register with some other piece of software) that
gets called when some specific set of conditions arise.
Like when the code executes it. You're talking about an event with a
callback. Normally you wait on that in a thread callback function.

Example: My sound recorder/scope. The soundcard API funcs set an
"Event" when there's data ready. I passed the address of a callback
to whatever it was. The callback function (I wrote) sets an event
and my processing thread (also has a callback) deals with the data
when it returns from WaitForSingleOblect(my_event_handle) . I think
I used an unneccessary indirection there, but wtf?

It would have been better to get a handle to that event and just
wait on it in a thread callback.

pass the thread callback func pointer to the API func.

then in my thread callback:

WaitForSingleObject(HANDLE event_handle);

But you need the event handle. So I set my own event in a separate
callback. Oh! I can't pass the thread callback to the api because it
gets called when the thread is created and the thread terminates
when the callback function returns.
Post by Spehro Pefhany
The business of sharing resources between threads in a threaded
environment (where you can, for some purposes, pretend that the
computer is executing multiple bits of software simultaneously) is
fairly complex and involves a lot of fairly odd terminology (mutex,
semaphore etc.) Most of my stuff doesn't have an RTOS so neither the
facilities or the complexity are there.
Thanks for the refresher.
--
Best Regards,
Mike
Genome
2004-12-19 21:04:48 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
No,

As you know.... and I don't,

You deal with interrupts on the basis of priority which means an interrupt
with higher priority interrupts the original interrupt.

After dealing with the important interrupt then the system 'fallsback' to
deal with the original interrupt(s)..... in order of prioratisation.

A 'callback' is a check to see if the nonprioritised thing that went
'squeek' really needed stroking in the first place.

DNA
Frank Bemelman
2004-12-19 21:18:21 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
It's when you pass the address of a function to the operating
system. Often used to change the standard behaviour of gadgets
supplied by the OS, and where only your program 'knows' how
it should be done. Such an example is the open-file-box that
windows presents, which can have many different 'faces' depending
on the application that calls it. Some common options can be
changed by simple parameters, but if you want some really odd
behaviour, you write the tricky part of the code yourself and use a
callback. Also called a hook.
Post by John Larkin
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
Like you say, it's a flag. An alternative to a single flag
could be a stack or queue of 'things that need to be done'.
Or un-done ;)
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Fred Bloggs
2004-12-19 21:26:54 UTC
Permalink
Post by Frank Bemelman
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
It's when you pass the address of a function to the operating
system. Often used to change the standard behaviour of gadgets
supplied by the OS, and where only your program 'knows' how
it should be done. Such an example is the open-file-box that
windows presents, which can have many different 'faces' depending
on the application that calls it. Some common options can be
changed by simple parameters, but if you want some really odd
behaviour, you write the tricky part of the code yourself and use a
callback. Also called a hook.
Sounds simple enough- think I used something similar long before there
ever was such a word.
Frank Bemelman
2004-12-19 22:18:42 UTC
Permalink
Post by Fred Bloggs
Post by Frank Bemelman
It's when you pass the address of a function to the operating
system. Often used to change the standard behaviour of gadgets
supplied by the OS, and where only your program 'knows' how
it should be done. Such an example is the open-file-box that
windows presents, which can have many different 'faces' depending
on the application that calls it. Some common options can be
changed by simple parameters, but if you want some really odd
behaviour, you write the tricky part of the code yourself and use a
callback. Also called a hook.
Sounds simple enough- think I used something similar long before there
ever was such a word.
It is a simple concept. I think the word 'hook was more common with
hardware interrupts or hardware related bios calls. Later, with
graphical user interfaces, Apple Mac and GEM, these mechanisms were
named callbacks. I guess, under that name they must be around for
20-25 years...
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Martin Riddle
2004-12-19 22:00:43 UTC
Permalink
Its funny how many answers it takes. ;D
Post by Frank Bemelman
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
It's when you pass the address of a function to the operating
system. Often used to change the standard behaviour of gadgets
supplied by the OS, and where only your program 'knows' how
it should be done. Such an example is the open-file-box that
windows presents, which can have many different 'faces' depending
on the application that calls it. Some common options can be
changed by simple parameters, but if you want some really odd
behaviour, you write the tricky part of the code yourself and use a
callback. Also called a hook.
Post by John Larkin
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
Like you say, it's a flag. An alternative to a single flag
could be a stack or queue of 'things that need to be done'.
Or un-done ;)
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Fred Bloggs
2004-12-19 21:32:42 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
No- that is called "setting a flag to remind you to finish some chores"
and is an example of *re-entrant code*:-) Why in the world would that be
called "callback" unless you collect useless jargon?
John Larkin
2004-12-19 21:44:00 UTC
Permalink
Post by Fred Bloggs
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
No- that is called "setting a flag to remind you to finish some chores"
and is an example of *re-entrant code*:-)
The isr is not re-entrant. It just runs periodically to completion (in
about 12 usec) and takes various paths each run, depending on what
needs to be done. The flag makes sure I get all the necessary stuff
done, sooner or later.
Post by Fred Bloggs
Why in the world would that be
called "callback" unless you collect useless jargon?
Well, I like to learn things. Sorry.

John
Fred Bloggs
2004-12-19 21:54:34 UTC
Permalink
Post by John Larkin
Post by Fred Bloggs
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
No- that is called "setting a flag to remind you to finish some chores"
and is an example of *re-entrant code*:-)
The isr is not re-entrant.
Yes it is:
"Used to describe code which can have multiple simultaneous,
interleaved, or nested invocations which will not interfere with each
other. This is important for parallel processing, recursive functions or
subroutines, and interrupt handling."
Post by John Larkin
It just runs periodically to completion (in
about 12 usec) and takes various paths each run, depending on what
needs to be done. The flag makes sure I get all the necessary stuff
done, sooner or later.
Right- so that would be interleaved calls.
John Larkin
2004-12-19 22:04:00 UTC
Permalink
Post by Fred Bloggs
Post by John Larkin
Post by Fred Bloggs
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
No- that is called "setting a flag to remind you to finish some chores"
and is an example of *re-entrant code*:-)
The isr is not re-entrant.
"Used to describe code which can have multiple simultaneous,
interleaved, or nested invocations which will not interfere with each
other. This is important for parallel processing, recursive functions or
subroutines, and interrupt handling."
Post by John Larkin
It just runs periodically to completion (in
about 12 usec) and takes various paths each run, depending on what
needs to be done. The flag makes sure I get all the necessary stuff
done, sooner or later.
Right- so that would be interleaved calls.
That's all nice, but my isr isn't reentrant and is simply executed
periodically and runs to completion every time. There's no os, no
multitasking, no nested interrupts, the variables are static, so it
can't be re-entered. No interleaving, either, just a couple of
conditional branches within the routine.

I've written reentrant code (and reentrant isr's and three
multitasking RTOSs) and this ain't.

This is in a 68332 with 8-bit eprom. At startup time, the "prototype"
routine is copied from eprom into the CPU internal ram, where it's
executed. That's a lot faster.

John
Anthony Fremont
2004-12-19 21:50:21 UTC
Permalink
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some chores"
and is an example of *re-entrant code*:-) Why in the world would that be
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.

When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
Fred Bloggs
2004-12-19 22:00:05 UTC
Permalink
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
John Larkin
2004-12-19 22:07:01 UTC
Permalink
Post by Fred Bloggs
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
So any code that's ever run more than once is "re-entrant"?

John
Fred Bloggs
2004-12-19 22:17:52 UTC
Permalink
Post by John Larkin
Post by Fred Bloggs
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
So any code that's ever run more than once is "re-entrant"?
John
I am thinking of real-time assembler- you are doing something else. If
these tasks to be done have some global status variable indicating the
what service tasks have been done and are yet to be done, then a
re-entrant ISR which reads this status does what you want.
Rufus V. Smith
2004-12-22 15:39:37 UTC
Permalink
Post by John Larkin
Post by Fred Bloggs
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
So any code that's ever run more than once is "re-entrant"?
No, that's just code.

Re-entrant code can be run from multiple threads, and are not
dependent upon one thread running the code to completion
before the other thread can run the same code.

Typically re-entrant code has no side-effects, and no
static variables. Everything modified typically is in registers
or on the stack, (or perhaps passed as a parameter by
the caller).

All ISRs should be re-entrant, though they needn't be,
if you control your interrupt sources.

Re-entrant code isn't simply an ISR. When threads
are swapped preemptively, any routine that could
be interrupted and called by another thread needs
to be re-entrant.

I guess that's the same thing I said in the first
paragraph.

Rufus
Anthony Fremont
2004-12-19 22:15:40 UTC
Permalink
Post by Fred Bloggs
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can
call itself recursively or be executed in several threads across
multiple processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
I thought you were referring to the act of him using a flag as being an
example of re-entrancy. I didn't know you were refering to the ISR in
general.

At any rate, an ISR is not necessarily re-entrant. I would say that
most interrupt handlers in the 8/16 bit micro world are not.
Richard
2004-12-22 18:31:06 UTC
Permalink
Post by Fred Bloggs
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
I am not going to quibble with your high level semantics- if the code
can be re-entered to perform its processing to completion then it is
re-entrant, period. I am not interested into any universal
all-encompassing definitions. It is a *simple* ISR.
No, re-entrant code has a specific definition, that is not it, others
have covered it well enough in this thread.
--
Richard
John Larkin
2004-12-19 22:04:30 UTC
Permalink
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
AKA "pure" code.

John
Anthony Fremont
2004-12-20 10:12:58 UTC
Permalink
Post by John Larkin
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Anthony Fremont
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores" and is an example of *re-entrant code*:-) Why in the world
would that be called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can
call itself recursively or be executed in several threads across
multiple processors concurrently with only one copy in memory.
AKA "pure" code.
Well.....I guess if it were to be really pure code, all addresses would
have to be relative to the instruction counter. ;-) We used to call
this floatable code as it could be just plunked into memory anywhere and
executed.
John Larkin
2004-12-20 16:17:30 UTC
Permalink
On Mon, 20 Dec 2004 10:12:58 GMT, "Anthony Fremont"
Post by Anthony Fremont
Post by John Larkin
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Anthony Fremont
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores" and is an example of *re-entrant code*:-) Why in the world
would that be called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can
call itself recursively or be executed in several threads across
multiple processors concurrently with only one copy in memory.
AKA "pure" code.
Well.....I guess if it were to be really pure code, all addresses would
have to be relative to the instruction counter. ;-) We used to call
this floatable code as it could be just plunked into memory anywhere and
executed.
My (perhaps non-professional-programmer) definition of that is
"relocatable" or "PIC" (position independent) code.

"Pure" code is code that has no associated statics and if of course
not self-modifying, so that it can be executed by multiple threads
without hassle.

John
John Woodgate
2004-12-20 16:52:51 UTC
Permalink
and if of course not
self-modifying, so that it can be executed by multiple threads without
hassle.
A veritable model of recidivism!
--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Active8
2004-12-21 17:10:32 UTC
Permalink
Post by John Larkin
On Mon, 20 Dec 2004 10:12:58 GMT, "Anthony Fremont"
Post by Anthony Fremont
Post by John Larkin
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Anthony Fremont
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores" and is an example of *re-entrant code*:-) Why in the world
would that be called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can
call itself recursively or be executed in several threads across
multiple processors concurrently with only one copy in memory.
AKA "pure" code.
Well.....I guess if it were to be really pure code, all addresses would
have to be relative to the instruction counter. ;-) We used to call
this floatable code as it could be just plunked into memory anywhere and
executed.
My (perhaps non-professional-programmer) definition of that is
"relocatable" or "PIC" (position independent) code.
Right. As opposed to "absolute", IIRC.
Post by John Larkin
"Pure" code is code that has no associated statics and if of course
not self-modifying, so that it can be executed by multiple threads
without hassle.
"Static" referes to local variables that retain their values between
calls. Static linking of a function (declared in a class
declaration) means that all instances of that class use the same
function at the same location.

My def?

Reentrant code means that a program can have more than one thread
executing concurrently.

http://vergil.chemistry.gatech.edu/resources/programming/threads.html

Eh? Kinda general really.

If you do something to modify a variable and another thread executes
the function it may or may not get a valid value. First,
"concurrently". It's an illusion for a single processor system. They
get a time slice. But when the threads pause, the code where
execution left off is reentered.
--
Best Regards,
Mike
Anthony Fremont
2004-12-21 22:35:09 UTC
Permalink
Post by John Larkin
My (perhaps non-professional-programmer) definition of that is
"relocatable" or "PIC" (position independent) code.
Yes, PIC is more common it seems. I come from the less popular
GE/Honeywell/Bull background. Actually, the GE part was a little (and I
do mean little) before my time.
Post by John Larkin
"Pure" code is code that has no associated statics and if of course
not self-modifying, so that it can be executed by multiple threads
without hassle.
You are right, of course. ;-)
Roger Hamlett
2004-12-22 10:26:22 UTC
Permalink
The silly thing is that the thread has 'run off' into a whole variety of
code areas not associated with a callback at all...
A 'callback', is exactly what it says, and comes from the useage on the
telephone, where you ring somebody, and they say they will 'call back'.
There are a number of reasons. The first would be the obvious one (I'll
call back, when I have the answer). The advantage here is it removes the
need for an 'interrupt' signal to give a fast response, or a polling
process to monitor the response of the subroutine. It can also be used for
a security application (just as on the phone, where your bank 'calls
back', to verify that they are talking to the person expected). This is
rare in PC applications, but is quite common in some other OS's, but can
be used on the PC, so that the 'callback', is operating at a different
security level to the calling code. There is also the 'billing' reason (as
in the phone call, where you call somebody, and they say they will 'call
back', so that the charges go onto their account). In the computer
version, this allows the 'callback', to be using time from the subroutine
process, rather than from the main code. Again this could be at a
different priority to the calling routine.

Best Wishes
Active8
2004-12-21 17:01:49 UTC
Permalink
Post by John Larkin
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
AKA "pure" code.
Reentrant code means that a program can have more than one thread
executing concurrently.

http://vergil.chemistry.gatech.edu/resources/programming/threads.html
--
Best Regards,
Mike
John Larkin
2004-12-21 18:19:49 UTC
Permalink
Post by Active8
Post by John Larkin
On Sun, 19 Dec 2004 21:50:21 GMT, "Anthony Fremont"
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
AKA "pure" code.
Reentrant code means that a program can have more than one thread
executing concurrently.
http://vergil.chemistry.gatech.edu/resources/programming/threads.html
My illustrative example is a cooking school. One big recipe is posted
on the wall, and lots of students are reading it and cooking, each at
their own pace. They maintain their own local variables, the stuff in
their pots. The code remains pure as long as nobody splashes anything
on it.

John
Active8
2004-12-21 16:51:07 UTC
Permalink
Post by Fred Bloggs
Post by Fred Bloggs
No- that is called "setting a flag to remind you to finish some
chores"
Post by Fred Bloggs
and is an example of *re-entrant code*:-) Why in the world would that
be
Post by Fred Bloggs
called "callback" unless you collect useless jargon?
That's certainly the most unique definition of re-entrancy that I've
seen.
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
That's called static linking.
--
Best Regards,
Mike
Anthony Fremont
2004-12-21 19:00:52 UTC
Permalink
Post by Active8
Post by Anthony Fremont
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can call
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
That's called static linking.
Not as I understand things. Static linking is when you satisfy all
external references at compile/link time, incorporating all the library
routines right into your bound executable. This generally makes for
quite large (megabytes) executable files, but also means that the
executable contains everything necessary to run. This means people wont
have to install a bunch of libraries to be able to execute it.

This is as opposed to dynamic linking where external references are
satisfied at run-time. This is done in windows with DLL libs or in
Linux with .so libs. The executable file only contains references to
the desired routines and acceptable versions (aka stubs); a dynamic
linker pieces it all together just in the nick of time. The dynamic
linker is part of the OS. This tends to make the executables much
smaller as all that's in them is the core code of the application and a
bunch of external references (not to be confused with object files).

There is no mandate of recursion or re-entrancy other than that dynamic
library scenarios are typically done in a manner to support a single
resident copy of the code segment even with multiple threads
simultaneously executing.

Statically linked programs would usually lead to multiple copies of the
same code being in memory when multiple occurrences of the program are
in execution. It's also possible that the OS might handle two
occurrences of the same executable by using one mostly shared copy by
implementing copy-on-write to clone pages as necessary.

I guess that's my 2cents anyhoo. ;-)
Active8
2004-12-21 19:29:54 UTC
Permalink
Post by Anthony Fremont
Post by Active8
Post by Anthony Fremont
When I think of re-entrant code, I think of code that has no local
variable storage associated to it. I also think of code that can
call
Post by Active8
Post by Anthony Fremont
itself recursively or be executed in several threads across multiple
processors concurrently with only one copy in memory.
That's called static linking.
Not as I understand things. Static linking is when you satisfy all
external references at compile/link time, incorporating all the library
routines right into your bound executable.
Yup. I'm still talking of static storage but thinking of linking.

<snip>
--
Best Regards,
Mike
steven
2004-12-19 22:48:16 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
Example.
Take the Windows GDI LineDDA function. It takes 2 points as input and
calculates all points that make a line between them. Now LineDDA calculates
the first point, but it can't just return to the caller because the other
points have to be calculated too. OTOH, it doesn't know what to do with the
point (should it be drawn on a canvas, or added to a list?)
That's why the calling routine has to supply a pointer to a callback
function. Each time LineDDA has calculated a point it passes it to the
callback function. The callback function may draw the point on a canvas,
that's part of the application, and after it's done it returns control back
to the LineDDA function, which then goes on to calculate the next point.
So the application calls LineDDA, and during the LineDDA algorithm it calls
back an application function.
In the LineDDA case the callback will called several times, but it could
also be just once.

Another example.
Hans-Bernhard already mentioned sorting.
Sorting can only be done within ordered set. Numerical lists are ordered
differently from numerical lists, so you'll have different compare
functions. Apart from the comparison itself however, the sorting algorithm
can be the same for any type of set.
So you write a sort routine requiring a callback function. The sorting
routine knows when which item should be compared to which other. That's
defined in the algorithm. But it doesn't know how thsi comparison is to be
done. So it calls the callback, saying "hey, I've got an item A and an item
B here which require comparison. Which should go first?". The callback
function decides and returns the result to the sorting routine, which may
e.g. decide that A and B should be swapped.

HTH

--
Steven
Richard Henry
2004-12-19 23:46:06 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
My experience with them is that when a piece of system software loads, such
as a device driver, that any application might want to call without knowing
where it is located, the driver will load an address in a system table (tied
to hardware or software interrupts, perhaps) so the application can find the
function when needed.
john jardine
2004-12-20 01:15:24 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
It's just windows hyperbola. Click a (say) button somewhere and the ID
number you gave the button is stored on the "message" stack. At some point
in your prog' you may wish to rummage through the messages to see if that
particular number has turned up.
If you've a PowerBasic for windows, the help file makes a (bad!) effort to
describe it.
regards
john
Genome
2004-12-20 01:26:41 UTC
Permalink
Post by john jardine
describe it.
regards
john
Cunt... what is the recipe for haggis?
Aye?
Aye?
Aye?

DNA
Spehro Pefhany
2004-12-20 01:36:53 UTC
Permalink
On Mon, 20 Dec 2004 01:26:41 GMT, the renowned "Genome"
Post by Genome
Post by john jardine
describe it.
regards
john
Cunt... what is the recipe for haggis?
Aye?
Aye?
Aye?
DNA
Don't forget to prick your haggis.

Traditional Haggis (from Evelyn Hlabse, ***@po.CWRU.Edu)

1 sheep's pluck (stomach bag)
2 lb.. dry oatmeal
1 lb. suet
1 lb. lamb's liver
2 1/2 cups stock
1 large chopped onion
1/2 tsp. cayenne pepper, Jamaica pepper and salt

Boil liver and parboil the onion, then mince them together. Lightly
brown the oatmeal. Mix all ingredients together. Fill the sheep's
pluck with the mixture pressing it down to remove all the air, and sew
up securely. Prick the haggis in several places so that it does not
burst. Place haggis in boiling water and boil slowly for 4-5 hours.
Serves approximately 12.

Loading Image...
Loading Image...


Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
***@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
John Larkin
2004-12-20 02:42:28 UTC
Permalink
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany
Post by Spehro Pefhany
On Mon, 20 Dec 2004 01:26:41 GMT, the renowned "Genome"
Post by Genome
Post by john jardine
describe it.
regards
john
Cunt... what is the recipe for haggis?
Aye?
Aye?
Aye?
DNA
Don't forget to prick your haggis.
1 sheep's pluck (stomach bag)
2 lb.. dry oatmeal
1 lb. suet
1 lb. lamb's liver
2 1/2 cups stock
1 large chopped onion
1/2 tsp. cayenne pepper, Jamaica pepper and salt
Boil liver and parboil the onion, then mince them together. Lightly
brown the oatmeal. Mix all ingredients together. Fill the sheep's
pluck with the mixture pressing it down to remove all the air, and sew
up securely. Prick the haggis in several places so that it does not
burst. Place haggis in boiling water and boil slowly for 4-5 hours.
Serves approximately 12.
Serves approximately 11, if you invite me.

John
john jardine
2004-12-20 03:29:50 UTC
Permalink
Post by John Larkin
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany
Post by Spehro Pefhany
On Mon, 20 Dec 2004 01:26:41 GMT, the renowned "Genome"
Post by Genome
Post by john jardine
describe it.
regards
john
Cunt... what is the recipe for haggis?
Aye?
Aye?
Aye?
DNA
Don't forget to prick your haggis.
1 sheep's pluck (stomach bag)
2 lb.. dry oatmeal
1 lb. suet
1 lb. lamb's liver
2 1/2 cups stock
1 large chopped onion
1/2 tsp. cayenne pepper, Jamaica pepper and salt
Boil liver and parboil the onion, then mince them together. Lightly
brown the oatmeal. Mix all ingredients together. Fill the sheep's
pluck with the mixture pressing it down to remove all the air, and sew
up securely. Prick the haggis in several places so that it does not
burst. Place haggis in boiling water and boil slowly for 4-5 hours.
Serves approximately 12.
Serves approximately 11, if you invite me.
John
Yuuuuuck. You guys will eat anything.
At one time it was traditional round these parts to eat offal called Tripe
and Elder. Bought wrapped in newspaper, from a Tripe stall at the local
market and boiled in milk or served raw with vinegar to taste. Sourced from
some unmentionable parts of a cows body and utterly loathsome to look at or
handle.
As a kid my parents tried to get me eat some and I still vividly remember
wretching after forcing some of this obscenity in my mouth.
It stuck with me. On business in other countries it was always a trial
dealing with whatever nighmare foodstuffs (delicacies!) the hosts could
come up with. Stuffed Goose throat, animal head parts, sea animals not out
of place in a science fiction film. Ugh!. Eventually figured that a
countries food directly relates to how close the population are to their
poor peasant roots. Gimme a lump of beef any day.
regards
john
Kryten
2004-12-20 04:40:34 UTC
Permalink
"I have a theory that all Scottish food is based on a dare"
(Mike Meyers)

I've tried haggis and it doesn't taste as disgusting as the ingredients
suggest.
The sheep's stomach is as thin and inoffensive as a sausage skin, and does
the same job of holding it all together. Sausage skins were traditionally
pigs intestines, but few people think sausages are disgusting.

As for the rest, only lamb's liver sounds bad but even that is okay if
cooked well (e.g. as a small part of a grilled lamb chop)

IMHO it just looks like a poor but canny Scots lass faced with a Spartan
pantry had a good go at stretching a small cheap cut of offal into
flavouring the largest portion of sausage-substitute.

I found it a bit dry. Needs a good gravy, or dampening with a splash of
whisky (oh yes, it's not just for cornflakes).
Post by john jardine
Tripe
That is made of cow stomach, and is about 7 mm thick.
I hear it can be edible if cooked properly and even made to look okay (fried
in breadcrumbs like plaice).

But as you may know, we English are famous for boiling food to leach out the
flavour and vitamins into the water, then throwing the water away and eating
what is left.
Post by john jardine
As a kid my parents tried to get me eat some
That counts as child abuse IMHO.

Along with school dinners. The people responsible should have their livers
boiled for hours until grey and rubbery, then made to eat them. Dr. Lecter,
we have a job for you!
Post by john jardine
On business in other countries it was always a trial
dealing with whatever nightmare foodstuffs (delicacies!)
My mate has to go to Taiwan. He hates the endless kimchi.
I advised him not to ask for hot dog.
Post by john jardine
sea animals not out of place in a science fiction film.
Sea cucumber is much the same as squid.

The guy who first looked at a squid/octopus/oyster and thought "I'll try
eating that". I bet he was bloody hungry.

And what is the deal with oysters?
It's a fish built like a nut...
Richard Henry
2004-12-20 05:32:22 UTC
Permalink
Post by Kryten
And what is the deal with oysters?
It's a fish built like a nut...
Actually, I've heard it compared to something else altogether.
Craig Bergren
2004-12-20 11:30:00 UTC
Permalink
"I have a theory that all Scottish food is based on a dare" (Mike Meyers)
I found it a bit dry. Needs a good gravy, or dampening with a splash of
whisky (oh yes, it's not just for cornflakes).
I would think all the beef fat (suet) would keep it moist.
Post by john jardine
Tripe
That is made of cow stomach, and is about 7 mm thick. I hear it can be
Menudo, a traditional Mexican tripe soup and miraculous hangover cure.
Post by john jardine
sea animals not out of place in a science fiction film.
Sea cucumber is much the same as squid.
I don't think they are anything like squid. Squid are like tubes
with tentacles and if no prepared correctly can be quite rubbery. Sea
cucumbers are more like really stiff gelatin in texture and have no taste
of their own and take on the taste of whatever sauce they are cooked in.
Rich Grise
2004-12-20 04:37:11 UTC
Permalink
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany wrote:
...
Post by Spehro Pefhany
Don't forget to prick your haggis.
[abomination snipped]
Post by Spehro Pefhany
http://www.tulsascots.com/photos/haggis.jpg
http://haradakun.cool.ne.jp/shashin/haggis.jpg
Gagg! Looks kinda like The Maggot That Destroyed Cleveland.

Thanks!
Rich
Boris Mohar
2004-12-20 17:16:38 UTC
Permalink
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany
Post by Spehro Pefhany
Don't forget to prick your haggis.
1 sheep's pluck (stomach bag)
2 lb.. dry oatmeal
1 lb. suet
1 lb. lamb's liver
2 1/2 cups stock
1 large chopped onion
1/2 tsp. cayenne pepper, Jamaica pepper and salt
Boil liver and parboil the onion, then mince them together. Lightly
brown the oatmeal. Mix all ingredients together. Fill the sheep's
pluck with the mixture pressing it down to remove all the air, and sew
up securely. Prick the haggis in several places so that it does not
burst. Place haggis in boiling water and boil slowly for 4-5 hours.
Serves approximately 12.
http://www.tulsascots.com/photos/haggis.jpg
http://haradakun.cool.ne.jp/shashin/haggis.jpg
Looks like a giant maggot.. Fancy some geoduck?

Loading Image...



Regards,

Boris Mohar

Got Knock? - see:
Viatrack Printed Circuit Designs http://www3.sympatico.ca/borism/
John Woodgate
2004-12-20 18:46:48 UTC
Permalink
I read in sci.electronics.design that Boris Mohar <borism_-void-
Post by Boris Mohar
Looks like a giant maggot.. Fancy some geoduck?
I can't even pronounce it.
--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Boris Mohar
2004-12-20 20:39:41 UTC
Permalink
On Mon, 20 Dec 2004 18:46:48 +0000, John Woodgate
Post by John Woodgate
I read in sci.electronics.design that Boris Mohar <borism_-void-
Post by Boris Mohar
Looks like a giant maggot.. Fancy some geoduck?
I can't even pronounce it.
http://www.olywa.net/cook/faq.htm




Regards,

Boris Mohar

Got Knock? - see:
Viatrack Printed Circuit Designs http://www3.sympatico.ca/borism/
Rich Grise
2004-12-21 04:14:31 UTC
Permalink
Post by John Larkin
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany
...
Post by John Larkin
Post by Spehro Pefhany
http://www.tulsascots.com/photos/haggis.jpg
http://haradakun.cool.ne.jp/shashin/haggis.jpg
Looks like a giant maggot.. Fancy some geoduck?
http://www.quitbuddies.org/Qb/geoduck.jpg
I thought it was goeduck. Isn't that feeding tube just meat, though? I
could see eating snail foot - I've never tried an oyster because it'd be
too much like eating little piles of guts.

I wish I could find some dried abalone - I should shop around the Asian
neighborhoods. In Korea, they had sun-dried squid, which was really quite
tasty. In Thailand, they have sun-dried lizard on a stick. Never tried one
of those. :-)

Cheers!
Rich
Rich Grise
2004-12-21 04:17:19 UTC
Permalink
Post by Rich Grise
Post by John Larkin
On Sun, 19 Dec 2004 20:36:53 -0500, Spehro Pefhany
...
Post by John Larkin
Post by Spehro Pefhany
http://www.tulsascots.com/photos/haggis.jpg
http://haradakun.cool.ne.jp/shashin/haggis.jpg
Looks like a giant maggot.. Fancy some geoduck?
http://www.quitbuddies.org/Qb/geoduck.jpg
I thought it was goeduck.
And I was wrong. :-)

According to my local dictionary, it's just geo-duck, like geocities.
Unless it's supposed to be a hard "g", as in "gooey".

Thanks!
Rich
nospam
2004-12-20 01:11:06 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions?
When you pass the address of a subroutine (usually in your code) to
something so that something can call the passed subroutine the subroutine
would often be called a callback.

Typically used for things like a list iterating routine where the callback
would be called for each item in the list.
Paul Hovnanian P.E.
2004-12-20 05:10:17 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
A callback is a function you register (store a pointer in a table, for
example) with some sort of scheduling routine that you want run when
some event occurs.
Post by John Larkin
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
In the purest sense of things, ISRs are pieces of code that are called
when some (physical) event occurs and are run 'outside' of the scheduled
tasks. In many OSs, ISRs are actually split into two parts, the 'bottom'
and 'top' halfs. The bottom half is the code that must be run at
interrupt time to save I/O data, reset h/w for the next event and set a
flag or schedule a task to do further processing for the event. The 'top
half' is the scheduled task that completes the processing necessary to
handle the event. This might be referred to as a 'callback' in some
systems.
--
Paul Hovnanian mailto:***@Hovnanian.com
------------------------------------------------------------------
You can discover what your enemy fears most by observing the
means he uses to frighten you. -- Eric Hoffer
Mike Monett
2004-12-20 06:37:23 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
That's a flag. Here's a good explanation of callbacks:

http://www.tutok.sk/fastgl/callback.html

Best,

Mike Monett
Active8
2004-12-21 17:33:42 UTC
Permalink
Post by Mike Monett
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
http://www.tutok.sk/fastgl/callback.html
Ah. Thanks. I didn't stop to think that templates are the way to
deal with unknown return types. Problem is that you can't actually
use that kind of function without passing the type as a template
parameter.

I had a prob with a template in a dll. It wouldn't link because the
implementation wasn't there.

Like

dll header
template class <T> MyClass{}

The program wouldn't link because there was no implementation.

I couldn't declare

MyClass myClass<int>;
--
Best Regards,
Mike
John Larkin
2004-12-21 19:16:20 UTC
Permalink
Post by Mike Monett
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
http://www.tutok.sk/fastgl/callback.html
Best,
Mike Monett
Good grief, but that's hairy stuff. No wonder Windows is such a flakey
pos. Makes me glad I program in assembly, where everything's in plain
sight.

As I now recall, the first time I encountered the "callback" concept
it was in a realtime assembly-language app. If an ISR didn't have time
to finish something, it poked a pointer to the "rest" of its code
somewhere and let the RTOS execute that later when resources were
available. DECs later OSs (RSXnn and VMS, I think) had a "fork"
facility that was similar.

John


John
Mike Monett
2004-12-22 05:07:45 UTC
Permalink
Post by John Larkin
Post by Mike Monett
http://www.tutok.sk/fastgl/callback.html
Best,
Mike Monett
Good grief, but that's hairy stuff. No wonder Windows is such a flakey
pos. Makes me glad I program in assembly, where everything's in plain
sight.
[...]
Post by John Larkin
John
Yes, assembly rocks. High level languages don't let you see what is
actually happening in the registers, so you miss good ways to optimize
the code. Although I prefer to let a good HLL to handle most of the
interface stuff, and focus my attention on the places where assembly can
really pay off in performance.

Another thing - it's amazing what can be accomplished in a few hundred
bytes of assembly. So how on earth can Windows consume hundreds of
megabytes to do basically the same thing? I mean, when a printer driver
requires 600 megabytes, something is seriously broken. There's no way a
cpu could be executing all that code all the time - in fact, there is
nothing that could possibly be that complex. So what is the reason for
the bloat???

Best,

Mike Monett
John Larkin
2004-12-22 05:36:40 UTC
Permalink
Post by Mike Monett
Post by John Larkin
Post by Mike Monett
http://www.tutok.sk/fastgl/callback.html
Best,
Mike Monett
Good grief, but that's hairy stuff. No wonder Windows is such a flakey
pos. Makes me glad I program in assembly, where everything's in plain
sight.
[...]
Post by John Larkin
John
Yes, assembly rocks. High level languages don't let you see what is
actually happening in the registers, so you miss good ways to optimize
the code. Although I prefer to let a good HLL to handle most of the
interface stuff, and focus my attention on the places where assembly can
really pay off in performance.
Another thing - it's amazing what can be accomplished in a few hundred
bytes of assembly. So how on earth can Windows consume hundreds of
megabytes to do basically the same thing? I mean, when a printer driver
requires 600 megabytes, something is seriously broken. There's no way a
cpu could be executing all that code all the time - in fact, there is
nothing that could possibly be that complex. So what is the reason for
the bloat???
Best,
Mike Monett
Yeah, this is snipped from the "tutok" web page you referenced...



MemberTranslator1(Callee &c,const MemFunc &m):
Functor1<P1>(thunk,&c,&m,sizeof(MemFunc)){}
static void thunk(const FunctorBase &ftor,P1 p1)
{
Callee *callee = (Callee *)ftor.callee;
MemFunc &memFunc(*(MemFunc*)(void *)(ftor.memFunc));
(callee->*memFunc)(p1);
}
};



OK, imagine trying to understand and maintain 100 millions lines of
code like this. If you passed it through triple-DES encryption, it
couldn't look much worse.

John
Frank Bemelman
2004-12-22 08:59:35 UTC
Permalink
Post by John Larkin
OK, imagine trying to understand and maintain 100 millions lines of
code like this. If you passed it through triple-DES encryption, it
couldn't look much worse.
Well, you write, test, approve and forget ;) Most of the code is
pretty harmless and straight forward anyway.

There's a lot of things behind the scenes. Nobody is amazed when
he/she hits the print button and a printer dialog pops up. And I
have no idea how *your* printer dialog looks like. And neither
has a windows application, when it happens. And the printer driver
has no idea where your printer is, at lpt1, com2, usb or somewhere
on your ethernet network. And of course you expect a gentle warning
that it might be turned off, or has run out of paper or ink.
And you want to run it from 7 applications at the same time, each
using different papersizes, while your secretary wants the same
printer to print a sheet of labels that she has put in the manual
feed tray...

That is just one example. It is a lot easier to write robust code
for a full featured pinball machine.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Mike Monett
2004-12-22 13:04:25 UTC
Permalink
John Larkin wrote:

[...]
Post by John Larkin
Yeah, this is snipped from the "tutok" web page you referenced...
Functor1<P1>(thunk,&c,&m,sizeof(MemFunc)){}
static void thunk(const FunctorBase &ftor,P1 p1)
{
Callee *callee = (Callee *)ftor.callee;
MemFunc &memFunc(*(MemFunc*)(void *)(ftor.memFunc));
(callee->*memFunc)(p1);
}
};
OK, imagine trying to understand and maintain 100 millions lines
of code like this. If you passed it through triple-DES encryption,
it couldn't look much worse.
John
100 million lines? Sad, but Windows is probably getting close.

I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.

For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.

It can load up to 27 files simultaneously and automatically detects
the file type when switching from one window to the next. It
switches the command functions as appropriate for the type of file,
so I don't have to memorize different commands and keystrokes
depending on the file type in the current window.

The editor is very compact and and loads instantly. It rarely
crashes, except when Windows crashes on a bad pointer and messes up
memory. It is blazingly fast on a 200MHz Pentium, so there is
little need for a 2GHz machine (except to read those #$%@&* Adobe
pdf files:)

Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.

Best,

Mike Monett
Frank Bemelman
2004-12-22 14:10:08 UTC
Permalink
Post by Mike Monett
I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.
Windows isn't bloated at all. There's just a lot of things to be dealt
with, but that happens so incredibly transparent to the casual observer,
that we take it all for granted and assume the code is bloated or something.
Post by Mike Monett
For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.
[snip]
Post by Mike Monett
Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.
This style of thinking would probably kept us all back in 1988, the release
date of your editor ;)
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Everett M. Greene
2004-12-22 17:44:50 UTC
Permalink
Post by Frank Bemelman
Post by Mike Monett
I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.
Windows isn't bloated at all. There's just a lot of things to be dealt
with, but that happens so incredibly transparent to the casual observer,
that we take it all for granted and assume the code is bloated or something.
There's a difference between doing something because it can
be done and doing something because it's needed. Microsoft
can throw the problem of hardware resources over the wall
to the users at no cost to themselves.
Post by Frank Bemelman
Post by Mike Monett
For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.
[snip]
Post by Mike Monett
Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.
This style of thinking would probably kept us all back in 1988, the
release date of your editor ;)
This is precisely the thinking that's needed and necessary
for /embedded/ computing. Reliability and hardware resources
are directly impacted by keeping things as simple as possible.
Spehro Pefhany
2004-12-22 18:42:12 UTC
Permalink
On Wed, 22 Dec 2004 09:44:50 PST, the renowned
Post by Everett M. Greene
Post by Frank Bemelman
Post by Mike Monett
I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.
Windows isn't bloated at all. There's just a lot of things to be dealt
with, but that happens so incredibly transparent to the casual observer,
that we take it all for granted and assume the code is bloated or something.
There's a difference between doing something because it can
be done and doing something because it's needed. Microsoft
can throw the problem of hardware resources over the wall
to the users at no cost to themselves.
Post by Frank Bemelman
Post by Mike Monett
For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.
[snip]
Post by Mike Monett
Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.
This style of thinking would probably kept us all back in 1988, the
release date of your editor ;)
This is precisely the thinking that's needed and necessary
for /embedded/ computing. Reliability and hardware resources
are directly impacted by keeping things as simple as possible.
How about this analogy?

I often need to shave dimes and pennies off of hardware for production
purposes (corresponding, of course to a multiple of that in the
selling price), but when I buy a *tool* for *business use*, an extra
$10 or $100 is often no big deal if I get something valuable in
return.

Spending a certain amount of today's bountiful desktop disk space and
processor processor bandwidth to get a tool that's as feature-rich as
makes sense to the authors of the program (hopefully) and easy to
install and configure (again) is not silly at all. Even on inexpensive
products, we sure don't write everything in tightly crafted assembler
any more. It's not as simple as possible, but rather as simple as
makes sense with the resources at hand.


Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
***@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Frank Bemelman
2004-12-22 18:58:48 UTC
Permalink
Post by Everett M. Greene
Post by Frank Bemelman
Post by Mike Monett
I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.
Windows isn't bloated at all. There's just a lot of things to be dealt
with, but that happens so incredibly transparent to the casual observer,
that we take it all for granted and assume the code is bloated or something.
There's a difference between doing something because it can
be done and doing something because it's needed. Microsoft
can throw the problem of hardware resources over the wall
to the users at no cost to themselves.
Nobody forces you to use the latest windows software. If DOS3.22
works for you, why upgrade?
Post by Everett M. Greene
Post by Frank Bemelman
Post by Mike Monett
For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.
[snip]
Post by Mike Monett
Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.
This style of thinking would probably kept us all back in 1988, the
release date of your editor ;)
This is precisely the thinking that's needed and necessary
for /embedded/ computing. Reliability and hardware resources
are directly impacted by keeping things as simple as possible.
For simple middle-of-the-road embedded computing, yes.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Mike Monett
2004-12-22 20:11:36 UTC
Permalink
Frank Bemelman wrote:

[...]
Post by Frank Bemelman
Nobody forces you to use the latest windows software. If DOS3.22
works for you, why upgrade?
[...]

Actually, it's a complete operating system that runs on top of DOS, the same as
earlier versions of Windows. Here's a partial screen shot:

..\ 2F87BA86 Previous Directory
\IE50REG 2F87BA86 Backup Copy of MSIE REG16x2.DAT
\REGDATA 2F87BA87 Explorer 5.0 Verisign Certificates 93% slack
\SYSTEM 2F87BA88 System Files
\ZIP 2F87BB39 Backup Directory
NISTIMEW CFG 310B6F05 31 Configure NIST Time
LMOUSE COM 186A1940 34,658 Logitech Mouse
WIN COM 28FA792A 44,170 Win 3.1 Original
ANIMOUSE DAT 30FB555D 28 AniMouse Config
REG DAT 3196691D 55,922 Win 3.1 Original
REG16X2 DAT 2CCD8EFA 58,730 Explorer 5.0 Keep a backup copy in IE50REG
NISTIME DIF 3193BD23 1,079 Nist Time Log
WINSOCK DLL 20489086 30,516 Moved Here From G:\SYMPATIC
HK DOC 2EC67370 9,757 HotKey
ANIMOUSE EXE 1ED12800 378,464 AniMouse
CALC EXE 186A1940 43,072 Win 3.1 Accessories
CALENDAR EXE 186A1940 59,824 Win 3.1 Accessories

The columns show the file or directory name, extension, date in hex format,
filesize, and a comment field that contains information about the file. This
information goes with the file when I move or copy it to a different directory,
and the information can be changed as needed without breaking links to other
programs, such as image links in html files.

The cursor (not shown) hilites a file in yellow. Pressing various function or
command keys will erase the file, copy or move it to a different directory, or
execute a specific program associated with the file. For example, it loads an
editor or file viewer as needed, or starts Windows and loads the appropriate
program all with a single keystroke.

I have numerous search programs that can index the entire disk in minutes and
locate any file in seconds. I never have to type in a filename or directory, and
all the needed commands are under control of the cursor and function keys. I
never have to remember all the options needed with various programs, such as
PKZIP or PKUNZIP. They are all encoded and attached when the program loads.

This method is the opposite of the Windows procedure, where you load a program
first, then search for the desired file. It is several orders of magnitude
faster than Windows, and completely avoids the confusion and errors when you
cannot locate the desired file or load the wrong one.

IMHO, this is the way Windows should have been designed from the beginning.

Best,

Mike Monett
Frank Bemelman
2004-12-22 21:04:10 UTC
Permalink
Post by Mike Monett
[...]
Post by Frank Bemelman
Nobody forces you to use the latest windows software. If DOS3.22
works for you, why upgrade?
[...]
This method is the opposite of the Windows procedure, where you load a program
first, then search for the desired file. It is several orders of magnitude
faster than Windows, and completely avoids the confusion and errors when you
cannot locate the desired file or load the wrong one.
Seems that you've got yourself organized well. But under windows I too
select
files and hit enter. Or click it with the right mouse key, and choose from
print, mail-to, compile/make, copy, zip, or whatever is a valid option for
that
particular type of file under my mouse pointer. Win3.1 never attracted me.
Much too much trouble with that. But a lot has improved since then.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Mike Monett
2004-12-22 18:30:36 UTC
Permalink
Frank Bemelman wrote:

[...]
Post by Frank Bemelman
This style of thinking would probably kept us all back in 1988, the release
date of your editor ;)
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Heh - I run Win 3.11 on a 200MHz machine with 8 gig hard disk and 64 meg ram. Most
of the time I'm in DOS, where I use my own operating system. It responds
instantaneously to any command and rarely crashes except when Windows calls a bad
pointer and takes everything down. But a reboot only takes seconds and I'm back in
business.

Your system needs a 2GHz machine with gazillion gigabytes of hard disk and more ram
than most disk drives had in the 80's. Your operating system and word processor
take much longer to load, and you are constantly attacked by viruses, trojans,
adware, and popups.

Tell me again how things have improved since the 80's:)

(Although I do have to admit I will be happy when I can find a 2GHz machine that
will run all my code and still use my keyboard and mouse. Adobe is just too slow.)

Best,

Mike Monett
Frank Bemelman
2004-12-22 20:55:30 UTC
Permalink
Post by Mike Monett
[...]
Post by Frank Bemelman
This style of thinking would probably kept us all back in 1988, the release
date of your editor ;)
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Heh - I run Win 3.11 on a 200MHz machine with 8 gig hard disk and 64 meg ram. Most
of the time I'm in DOS, where I use my own operating system. It responds
instantaneously to any command and rarely crashes except when Windows calls a bad
pointer and takes everything down. But a reboot only takes seconds and I'm back in
business.
Your system needs a 2GHz machine with gazillion gigabytes of hard disk and more ram
than most disk drives had in the 80's. Your operating system and word processor
take much longer to load, and you are constantly attacked by viruses, trojans,
adware, and popups.
Well, I couldn't care less how much GHz or Gigabytes my machine has. I pay
the
$500 and take the box home. It works and I don't run out of space. Booting
takes
a minute, most applications start in less than 5 seconds except Protel that
shuffles for a minute, automatically reloading the last jobs I am working
on.
On average I reboot once a day, typically when I have been using Protel a
lot.
Post by Mike Monett
Tell me again how things have improved since the 80's:)
My editors have syntax highlighting, I can cut and paste between
applications,
I can view my pdf-files, either from the internet or from my own collection,
I can print my own documents as pdf's, print the stuff on the printer in the
other room, backup my files to the other computer in my small network,
design
my printed circuit boards and mail them to my manufacturer, use other
graphical
programs to make some really good looking pictures, write software for
windows
and a couple of microcontrollers such as 8051, PIC, AVR, SX, program them
with
my nifty device programmer, debug them in-circuit, have silly talks with my
brother using skype, keep my website up-to-date, running my database, acces
my
bank account, the list is endless.
Post by Mike Monett
(Although I do have to admit I will be happy when I can find a 2GHz machine that
will run all my code and still use my keyboard and mouse. Adobe is just too slow.)
Always try to be happy ;)
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
john jardine
2004-12-22 17:11:51 UTC
Permalink
Post by Mike Monett
[...]
Post by John Larkin
Yeah, this is snipped from the "tutok" web page you referenced...
Functor1<P1>(thunk,&c,&m,sizeof(MemFunc)){}
static void thunk(const FunctorBase &ftor,P1 p1)
{
Callee *callee = (Callee *)ftor.callee;
MemFunc &memFunc(*(MemFunc*)(void *)(ftor.memFunc));
(callee->*memFunc)(p1);
}
};
OK, imagine trying to understand and maintain 100 millions lines
of code like this. If you passed it through triple-DES encryption,
it couldn't look much worse.
John
100 million lines? Sad, but Windows is probably getting close.
I think part of the reason for code bloat is programmers have no
restrictions on their code size or performance requirements. They
should be given 200MHz Pentium computers with an 8 gig hard drive
and 64 megs of ram. That would fix slow, bloated code real fast.
For example, my editor uses Borland SPRINT, which was last released
in 1988 and was designed to run on an 8080 with 640k of ram. It
handles 11 different types of files, including html, plain ascii,
pascal, c, assembly, email, newsgroup postings, google groups, etc.
It can load up to 27 files simultaneously and automatically detects
the file type when switching from one window to the next. It
switches the command functions as appropriate for the type of file,
so I don't have to memorize different commands and keystrokes
depending on the file type in the current window.
The editor is very compact and and loads instantly. It rarely
crashes, except when Windows crashes on a bad pointer and messes up
memory. It is blazingly fast on a 200MHz Pentium, so there is
pdf files:)
Of course, this style of thinking would probably put a lot of
programmers and maybe some companies out of business. For some
strange reason, making things overly complex is good for business.
Best,
Mike Monett
Oh, how loudly wintel laugh on their way to the bank.
What honestly puzzles me though is, how have the computing/programming
industries avoided natural selection forces over the past 10-20 years?.
The present monopoly situation would like it that way but it seems only a
part answer. Where have all the free thinkers gone. The radicals. The
companies/individuals who can spot major failings and grab an opportunity?.

For example. Selection pressure works in the electronics industry and these
groups. A well applauded answer/solution to some need or discussion on a
complex requirement, would be one that involves great elegance, subtlety,
vast knowledge and ends up using just a few transistors and a diode. Anyone
can enjoy the result, few can appreciate the process of getting there.

Look at the programming groups. A well applauded answer to an obvious
question is one that is comprehensible only within higher ranks of the
priesthood and consumes at least half a ream of paper. (eg the above
callback 'paper'). There seems no individuals capable of or willing to break
rank.
Why was Acrobat version 6 allowed to see daylight?.
Where's the ace programmers with a vision and a bad-arsed attitude?.
I get a distinct smell/echo of a self supporting, arts type 'philosophy'
philosophy at work.

regards
john
John Woodgate
2004-12-22 17:45:04 UTC
Permalink
I read in sci.electronics.design that john jardine
Post by john jardine
Look at the programming groups. A well applauded answer to an obvious
question is one that is comprehensible only within higher ranks of the
priesthood and consumes at least half a ream of paper. (eg the above
callback 'paper'). There seems no individuals capable of or willing to
break rank. Why was Acrobat version 6 allowed to see daylight?. Where's
the ace programmers with a vision and a bad-arsed attitude?. I get a
distinct smell/echo of a self supporting, arts type 'philosophy'
philosophy at work.
I don't think we know for sure why the software business shows all the
signs of a species about to go extinct through spending too many
resources on lavish body decoration (read 'features that hardly anybody
will ever use'). It may be that corporate purchasing is to blame; it is
easier to get authorisation for $10 000 than for $100, because if it
costs $10 000, it MUST work, whereas for $1000 it MUST be too cheap. And
forget $100 entirely - that must be some sort of evil program that will
cause the company to collapse.

Even back in the 80s, lots of people were calling attention to the poor
quality of PC programs compared with, particularly, BBC Micro and Acorn
programs. No doubt RISC had something to do with that, but there was a
pride of achievement in producing compact code. The market for these
computers and their software appreciated that, too, because while memory
and storage were not hugely costly, funds were often very short and many
computers had minimal memory and disc capacity.

The people writing high-class compact code now seem confined to the same
freeware and shareware market sectors.
--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Mike Monett
2004-12-22 18:37:21 UTC
Permalink
john jardine wrote:
[...]
Post by john jardine
Oh, how loudly wintel laugh on their way to the bank.
What honestly puzzles me though is, how have the computing/programming
industries avoided natural selection forces over the past 10-20 years?.
The present monopoly situation would like it that way but it seems only a
part answer. Where have all the free thinkers gone. The radicals. The
companies/individuals who can spot major failings and grab an opportunity?.
[...]
Post by john jardine
regards
john
Microsoft has peaked and can only lose market share to Linux. Open Source is
becoming a viable business model. Things are improving, but remember, Rome
wasn't burned down in a day:)

Best,

Mike Monett
CBFalconer
2004-12-22 08:59:20 UTC
Permalink
Mike Monett wrote:
... snip ...
Post by Mike Monett
Another thing - it's amazing what can be accomplished in a few hundred
bytes of assembly. So how on earth can Windows consume hundreds of
megabytes to do basically the same thing? I mean, when a printer driver
requires 600 megabytes, something is seriously broken. There's no way a
cpu could be executing all that code all the time - in fact, there is
nothing that could possibly be that complex. So what is the reason for
the bloat???
Largely C++ and templates. Also linkage generally simply grabs
monster blobs, regardless of whether called or not.
--
Chuck F (***@yahoo.com) (***@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Rufus V. Smith
2004-12-20 16:46:04 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
John
A simple flag does not constitute a callback, what you are
describing is simply persistent memory.

Callbacks are used when a routine (typically event driven),
doesn't know what else needs to be done for an event. All it
knows is when the event occurs, if there is a procedure address
defined, to call it (back).

If you look at publish/subscribe, you have a multiple
call back situation. Every client subscribes to the
event by passing an execution address which the
publisher (server) keeps in a list. When the event
occurs, the server "calls back" all the functions passed
by the subscribing clients.

Of course, publish/subscribe can also be done with
messages or signals, too. The end result is pretty
much the same. (Though nigglers will tell you the
direct call back has threading and context issues...)

Rufus
Rene Tschaggelar
2004-12-21 11:28:24 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
A callback is a function call to a fuction that at design
time does not yet exist.

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Steve at fivetrees
2004-12-21 12:04:54 UTC
Permalink
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
What a strange thread. Full of misinformation such as this.

Steve
http://www.fivetrees.com
Rene Tschaggelar
2004-12-21 12:49:28 UTC
Permalink
Post by Steve at fivetrees
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
What a strange thread. Full of misinformation such as this.
Ah yes? All callbacks I worked with involved function whichs
specs were defined roughly but not implemented yet.
The proceedings involved writing this function and supplying
a pointer to it to the already existing code.
No?

Rene
Frank Bemelman
2004-12-21 13:04:56 UTC
Permalink
Post by Rene Tschaggelar
Post by Steve at fivetrees
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
What a strange thread. Full of misinformation such as this.
Ah yes? All callbacks I worked with involved function whichs
specs were defined roughly but not implemented yet.
The proceedings involved writing this function and supplying
a pointer to it to the already existing code.
No?
I'd say yes, now that you described it a bit better.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Active8
2004-12-21 13:53:03 UTC
Permalink
On Tue, 21 Dec 2004 14:04:56 +0100, "Frank Bemelman"
Post by Frank Bemelman
Post by Rene Tschaggelar
Post by Steve at fivetrees
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile. The function
*must* exist, however you can select a function and pass a pointer at
runtime.

You can't even compile a function in C++ without an implementation.

I think there's a terminology problem, here.

Prototype:

Function(int num, double, mag);

Definition - this is implementation:

Function(int num, double, mag)
{
// some crap code - or none at all
return num; //default return is int :)
}
Post by Frank Bemelman
Post by Rene Tschaggelar
Post by Steve at fivetrees
What a strange thread. Full of misinformation such as this.
Ah yes? All callbacks I worked with involved function whichs
specs were defined roughly but not implemented yet.
The proceedings involved writing this function and supplying
a pointer to it to the already existing code.
No?
I'd say yes, now that you described it a bit better.
Even an empty function is an *implementation* of a function.

I can write:

call bogus_pointer

for PIC and as long as there's a label "bogus_pointer", it'll go
there. That's an implementation. But that doesn't mean it won't
execute right on past the return that I forgot to include and f*ck
everything up.

So I include the return stmnt and everything's fine.

But to get back OT :) a good example of a call back is the function
pointer that must be passed to the "CreateWindow()" function in
winders API. It's the "WndProc" function in the prototype.

When winders OS needs to send a message (you clicked the little "x" in
the text editor) to a window it calls that WndProc function with a
handle to that window.

The callback can be static, i.e., it is shared by all processes
calling it.

The neat thing is that in the WndProc function, you can create a
controller object that stores (via SetWidowsLong(hWnd, ...) you pass
the window handle to identify which window) a pointer to itself in the
window's reserved data space.

Now the callback can access the controller object for that particular
window (say you have 2 text edit windows open in the same app) and
check whether you saved that text file yet. Or whatever.

But f*ck all that noise. Just use wxWidgets ! :) That's open source
and cross platform and used by major corps.

--
Best Regards,
Mike
Hans-Bernhard Broeker
2004-12-21 14:43:13 UTC
Permalink
Post by Active8
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile.
It's actually a lot more true than you believe. Rene may have
condensed its essence down to a little too few words for you to
recognize it, but he did get it right.
Post by Active8
The function *must* exist, however you can select a function and
pass a pointer at runtime.
You can't even compile a function in C++ without an implementation.
Correct, but that's not the issue at hand. We're talking about the
not-yet-existing implementation of a _called_ function, not its
caller.

To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet. More importantly, different calls to
'foo' may want to use different functions 'bar', at least some of
which aren't written yet.

So you declare the interface signature of 'bar', and make a pointer to
a function of that signature (or, in OO, an object implementing that
interface) part of the set of arguments passed to 'foo'.

The central aspect that makes this a good idea (compared to other
methods of selecting a function to call from a collection, e.g. an
index into a table of function pointers, or a switch() between a lot
of function calls), is indeed, as Rene pointed out, that it lets you
split up "compile time" into at least two separate phases, to be
carried out by different people, at different places and times: one is
the compilation time of 'foo', the other the (potentially lots of)
compilations of 'bar', and also of the function that calls 'foo' and
passes 'bar' to it.
Post by Active8
Even an empty function is an *implementation* of a function.
But an empty function is not part of this design --- there's just the
prototype, and a *pointer* to such a function. But no actual
implementation of any such function is involved in this design pattern
named "callback". That's how you can implement the pattern, without
having any implementation of the actual callback function at hand.
--
Hans-Bernhard Broeker (***@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Active8
2004-12-21 16:30:02 UTC
Permalink
On 21 Dec 2004 14:43:13 GMT, Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
Post by Active8
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile.
It's actually a lot more true than you believe. Rene may have
condensed its essence down to a little too few words for you to
recognize it, but he did get it right.
Post by Active8
The function *must* exist, however you can select a function and
pass a pointer at runtime.
You can't even compile a function in C++ without an implementation.
Correct, but that's not the issue at hand. We're talking about the
not-yet-existing implementation of a _called_ function, not its
caller.
To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet.
Something has to be declared or it won't compile. I know, that's not
a definition, just a generic function pointer. As you go on, it
becomes more clear what you're trying to say (I practiced this same
excersize with Kevin :) ) so don't feel compelled to comment on all
my comments.
Post by Hans-Bernhard Broeker
More importantly, different calls to
'foo' may want to use different functions 'bar', at least some of
which aren't written yet.
That's called function overloading and another way is polymorphism.

You can't *link* a function call to a function with no definition,
If it's *declared" in a header or somewhere "in scope", it will
*compile* but if the definition hasn't been written, the linker
won't find it's entry point in any modules and it won't *link*. But
that's not a generic function pointer I'm talking about.

IOW, you can't assign a *valid* pointer at runtime unless the
function is defined somewhere.

pfunc = atan;

won't work if the linker can't find atan.

pfunc = NULL;

pfunc = atan;

function(pfunc);

groovy, now hit "execute".
Post by Hans-Bernhard Broeker
So you declare the interface signature of 'bar', and make a pointer to
a function of that signature (or, in OO, an object implementing that
interface) part of the set of arguments passed to 'foo'.
As I said, I can pass any bogus pointer in a function. The fact is,
that function must have been defined (implemented) somewhere or it
won't link. At design time, not run time. You can grab a valid
pointer at runtime, but there *will be no valid pointer unless the
function was implemented and compiled in a module that the linker
can see.*

Period.
Post by Hans-Bernhard Broeker
The central aspect that makes this a good idea (compared to other
methods of selecting a function to call from a collection, e.g. an
index into a table of function pointers, or a switch() between a lot
of function calls), is indeed, as Rene pointed out, that it lets you
split up "compile time" into at least two separate phases, to be
carried out by different people, at different places and times: one is
the compilation time of 'foo', the other the (potentially lots of)
compilations of 'bar', and also of the function that calls 'foo' and
passes 'bar' to it.
None of this changes the fact that it won't link. Won't even compile
without a declaration.

function(void){}

void (*pfunc) ();

function(pfunc);

This will compile and link, but if you run this code, you have to
assign a value (address) to the function pointer pfunc and you
can't get that address if it's stilll vaporware.


None of this changes the fact that this ain't the definition of a
callback function.

This is funny. I just typed __define callback function__ into
google and didn't get any returns about phones.

http://gethelp.devx.com/techtips/cpp_pro/10min/10min0300.asp

<quote>
A callback function is one that is not invoked explicitly by the
programmer; rather the responsibility for its invocation is
delegated to another function that receives the callback function's
address.
</quote>

Period.
Post by Hans-Bernhard Broeker
Post by Active8
Even an empty function is an *implementation* of a function.
But an empty function is not part of this design --- there's just the
prototype, and a *pointer* to such a function.
where's the linker gonna get the damn valid pointer from, it's ass?
Post by Hans-Bernhard Broeker
But no actual
implementation of any such function is involved in this design pattern
named "callback". That's how you can implement the pattern, without
having any implementation of the actual callback function at hand.
Good. Now click "Execute". Oh. You're waiting on another group to
implement your function? So you wrote what's known to me as a
"stub". You could just as easily write an empty function if you
don't need the flexibility of function pointers.

say

func(){}

function(func);

and the function "function" will get the pointer to func and execute
it as a "callback". It's still a callback regardless of whether it's
implemented.
-
Best Regards,
Mike
Charles W. Johson Jr.
2004-12-21 23:56:47 UTC
Permalink
Post by Active8
On 21 Dec 2004 14:43:13 GMT, Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
Post by Active8
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile.
It's actually a lot more true than you believe. Rene may have
condensed its essence down to a little too few words for you to
recognize it, but he did get it right.
Post by Active8
The function *must* exist, however you can select a function and
pass a pointer at runtime.
You can't even compile a function in C++ without an implementation.
Correct, but that's not the issue at hand. We're talking about the
not-yet-existing implementation of a _called_ function, not its
caller.
To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet.
Something has to be declared or it won't compile. I know, that's not
a definition, just a generic function pointer. As you go on, it
becomes more clear what you're trying to say (I practiced this same
excersize with Kevin :) ) so don't feel compelled to comment on all
my comments.
Post by Hans-Bernhard Broeker
More importantly, different calls to
'foo' may want to use different functions 'bar', at least some of
which aren't written yet.
That's called function overloading and another way is polymorphism.
You can't *link* a function call to a function with no definition,
If it's *declared" in a header or somewhere "in scope", it will
*compile* but if the definition hasn't been written, the linker
won't find it's entry point in any modules and it won't *link*. But
that's not a generic function pointer I'm talking about.
IOW, you can't assign a *valid* pointer at runtime unless the
function is defined somewhere.
pfunc = atan;
won't work if the linker can't find atan.
pfunc = NULL;
pfunc = atan;
function(pfunc);
groovy, now hit "execute".
Post by Hans-Bernhard Broeker
So you declare the interface signature of 'bar', and make a pointer to
a function of that signature (or, in OO, an object implementing that
interface) part of the set of arguments passed to 'foo'.
As I said, I can pass any bogus pointer in a function. The fact is,
that function must have been defined (implemented) somewhere or it
won't link. At design time, not run time. You can grab a valid
pointer at runtime, but there *will be no valid pointer unless the
function was implemented and compiled in a module that the linker
can see.*
Period.
Post by Hans-Bernhard Broeker
The central aspect that makes this a good idea (compared to other
methods of selecting a function to call from a collection, e.g. an
index into a table of function pointers, or a switch() between a lot
of function calls), is indeed, as Rene pointed out, that it lets you
split up "compile time" into at least two separate phases, to be
carried out by different people, at different places and times: one is
the compilation time of 'foo', the other the (potentially lots of)
compilations of 'bar', and also of the function that calls 'foo' and
passes 'bar' to it.
None of this changes the fact that it won't link. Won't even compile
without a declaration.
function(void){}
void (*pfunc) ();
function(pfunc);
This will compile and link, but if you run this code, you have to
assign a value (address) to the function pointer pfunc and you
can't get that address if it's stilll vaporware.
None of this changes the fact that this ain't the definition of a
callback function.
This is funny. I just typed __define callback function__ into
google and didn't get any returns about phones.
http://gethelp.devx.com/techtips/cpp_pro/10min/10min0300.asp
<quote>
A callback function is one that is not invoked explicitly by the
programmer; rather the responsibility for its invocation is
delegated to another function that receives the callback function's
address.
</quote>
Period.
Post by Hans-Bernhard Broeker
Post by Active8
Even an empty function is an *implementation* of a function.
But an empty function is not part of this design --- there's just the
prototype, and a *pointer* to such a function.
where's the linker gonna get the damn valid pointer from, it's ass?
Post by Hans-Bernhard Broeker
But no actual
implementation of any such function is involved in this design pattern
named "callback". That's how you can implement the pattern, without
having any implementation of the actual callback function at hand.
Good. Now click "Execute". Oh. You're waiting on another group to
implement your function? So you wrote what's known to me as a
"stub". You could just as easily write an empty function if you
don't need the flexibility of function pointers.
say
func(){}
function(func);
and the function "function" will get the pointer to func and execute
it as a "callback". It's still a callback regardless of whether it's
implemented.
-
Best Regards,
Mike
What normally would be defined is only the function title and type ; void
mycallback (int,int,double);

then as long as the function mycallback accepts the correct variables and
returns void it would be entered later.

Windows uses this for the WinMain function in a basic C program, Windows is
given a function name in the Window definition often called WinProc()
windows then access that procedure rather than Main() to run the program.

Charles
Active8
2004-12-22 01:54:28 UTC
Permalink
Post by Charles W. Johson Jr.
Post by Active8
On 21 Dec 2004 14:43:13 GMT, Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
Post by Active8
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile.
It's actually a lot more true than you believe. Rene may have
condensed its essence down to a little too few words for you to
recognize it, but he did get it right.
Post by Active8
The function *must* exist, however you can select a function and
pass a pointer at runtime.
You can't even compile a function in C++ without an implementation.
Correct, but that's not the issue at hand. We're talking about the
not-yet-existing implementation of a _called_ function, not its
caller.
To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet.
Something has to be declared or it won't compile. I know, that's not
a definition, just a generic function pointer. As you go on, it
becomes more clear what you're trying to say (I practiced this same
excersize with Kevin :) ) so don't feel compelled to comment on all
my comments.
Post by Hans-Bernhard Broeker
More importantly, different calls to
'foo' may want to use different functions 'bar', at least some of
which aren't written yet.
That's called function overloading and another way is polymorphism.
You can't *link* a function call to a function with no definition,
If it's *declared" in a header or somewhere "in scope", it will
*compile* but if the definition hasn't been written, the linker
won't find it's entry point in any modules and it won't *link*. But
that's not a generic function pointer I'm talking about.
IOW, you can't assign a *valid* pointer at runtime unless the
function is defined somewhere.
pfunc = atan;
won't work if the linker can't find atan.
pfunc = NULL;
pfunc = atan;
function(pfunc);
groovy, now hit "execute".
Post by Hans-Bernhard Broeker
So you declare the interface signature of 'bar', and make a pointer to
a function of that signature (or, in OO, an object implementing that
interface) part of the set of arguments passed to 'foo'.
As I said, I can pass any bogus pointer in a function. The fact is,
that function must have been defined (implemented) somewhere or it
won't link. At design time, not run time. You can grab a valid
pointer at runtime, but there *will be no valid pointer unless the
function was implemented and compiled in a module that the linker
can see.*
Period.
Post by Hans-Bernhard Broeker
The central aspect that makes this a good idea (compared to other
methods of selecting a function to call from a collection, e.g. an
index into a table of function pointers, or a switch() between a lot
of function calls), is indeed, as Rene pointed out, that it lets you
split up "compile time" into at least two separate phases, to be
carried out by different people, at different places and times: one is
the compilation time of 'foo', the other the (potentially lots of)
compilations of 'bar', and also of the function that calls 'foo' and
passes 'bar' to it.
None of this changes the fact that it won't link. Won't even compile
without a declaration.
function(void){}
void (*pfunc) ();
function(pfunc);
This will compile and link, but if you run this code, you have to
assign a value (address) to the function pointer pfunc and you
can't get that address if it's stilll vaporware.
None of this changes the fact that this ain't the definition of a
callback function.
This is funny. I just typed __define callback function__ into
google and didn't get any returns about phones.
http://gethelp.devx.com/techtips/cpp_pro/10min/10min0300.asp
<quote>
A callback function is one that is not invoked explicitly by the
programmer; rather the responsibility for its invocation is
delegated to another function that receives the callback function's
address.
</quote>
Period.
Post by Hans-Bernhard Broeker
Post by Active8
Even an empty function is an *implementation* of a function.
But an empty function is not part of this design --- there's just the
prototype, and a *pointer* to such a function.
where's the linker gonna get the damn valid pointer from, it's ass?
Post by Hans-Bernhard Broeker
But no actual
implementation of any such function is involved in this design pattern
named "callback". That's how you can implement the pattern, without
having any implementation of the actual callback function at hand.
Good. Now click "Execute". Oh. You're waiting on another group to
implement your function? So you wrote what's known to me as a
"stub". You could just as easily write an empty function if you
don't need the flexibility of function pointers.
say
func(){}
function(func);
and the function "function" will get the pointer to func and execute
it as a "callback". It's still a callback regardless of whether it's
implemented.
-
Best Regards,
Mike
What normally would be defined is only the function title and type ; void
mycallback (int,int,double);
Ho hum. I gave the terminology twice already. That is not a
definition, it is a deeclaration.
Post by Charles W. Johson Jr.
then as long as the function mycallback accepts the correct variables and
returns void it would be entered later.
I also gave the definition of a callback function and it has
absolutely nothing to do with whether the function is implemented
(defined) or vaporware.
Post by Charles W. Johson Jr.
Windows uses this for the WinMain function in a basic C program, Windows is
Way off. The WinMain function (like main() in a DOS app) is the
application entry point which actually calls a WinMain function from
the CRT lib which has more parameters that you don't see.
Post by Charles W. Johson Jr.
given a function name in the Window definition often called WinProc()
^^^^^^^^^ wtf?

No. CreateWindow() and CreateWindowEx() are called to create a
window and the WndProc callback address is passed as a parameter.
Post by Charles W. Johson Jr.
windows then access that procedure rather than Main() to run the program.
No. The OS calls this function when it needs to pass a windows
message to the WndProc so the user can process it. Every window in
an app has it's own WndProc.
--
Best Regards,
Mike
FLY135
2004-12-22 01:47:08 UTC
Permalink
Post by Active8
On 21 Dec 2004 14:43:13 GMT, Hans-Bernhard Broeker
Post by Hans-Bernhard Broeker
Post by Active8
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
Not even remotely true, let alone possible to compile.
It's actually a lot more true than you believe. Rene may have
condensed its essence down to a little too few words for you to
recognize it, but he did get it right.
Post by Active8
The function *must* exist, however you can select a function and
pass a pointer at runtime.
You can't even compile a function in C++ without an implementation.
Correct, but that's not the issue at hand. We're talking about the
not-yet-existing implementation of a _called_ function, not its
caller.
To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet.
Something has to be declared or it won't compile. I know, that's not
a definition, just a generic function pointer. As you go on, it
becomes more clear what you're trying to say (I practiced this same
excersize with Kevin :) ) so don't feel compelled to comment on all
my comments.
Correction, you mean *link* not compile. I have made quite a few libraries
that compiled perfectly fine using callback functions that did not exist.
Some of them were dynamic link libraries where the code that contained the
callback calling code never knew of the existance of any particular callback
function at compile time. Typically I would implement callback interfaces
to have both a callback function pointer and an instance variable. That way
the client code that contained the callback could have multiple instances
usually implemented as a C++ class. The instance variable would be a void*
to the library, and the client could cast it back to whatever it wanted,
which was normally the "this" pointer for whatever class type it happened to
be.
Scott Stephens
2004-12-22 06:04:40 UTC
Permalink
Post by Active8
Post by Hans-Bernhard Broeker
To rephrase Rene's statement: a callback is what you use if a function
'foo' needs to be written now, which has to call another function
'bar' that may not exist yet.
http://gethelp.devx.com/techtips/cpp_pro/10min/10min0300.asp
<quote>
A callback function is one that is not invoked explicitly by the
programmer; rather the responsibility for its invocation is
delegated to another function that receives the callback function's
address.
</quote>
Period.
Post by Hans-Bernhard Broeker
Post by Active8
Even an empty function is an *implementation* of a function.
But an empty function is not part of this design --- there's just the
prototype, and a *pointer* to such a function.
Isn't that called an interface? Aren't MS COM objects (such as dhtml
Active-X objects) an example of such? The COM object interface are
pointers to an object-specific array of pointers.
Frank Bemelman
2004-12-21 12:57:36 UTC
Permalink
Post by Steve at fivetrees
Post by Rene Tschaggelar
A callback is a function call to a fuction that at design
time does not yet exist.
What a strange thread. Full of misinformation such as this.
90% of the responses were pretty much okay. That is not 'Full
of misinformation'.

Of course you don't bother to give any meaningful response
yourself. Like the majority of CAE, bunch of arrogant, boring
wannabees as they are.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Steve at fivetrees
2004-12-21 14:17:36 UTC
Permalink
Post by Frank Bemelman
Post by Steve at fivetrees
What a strange thread. Full of misinformation such as this.
90% of the responses were pretty much okay. That is not 'Full
of misinformation'.
Granted. However the 10% were fairly forceful ;).
Post by Frank Bemelman
Of course you don't bother to give any meaningful response
yourself. Like the majority of CAE, bunch of arrogant, boring
wannabees as they are.
CAE? not sure I know this one (other than Computer Aided Engineering).
Post by Frank Bemelman
Post by Steve at fivetrees
A callback is a function call to a fuction that at design time does not
yet exist. <<

That's one potential/peripheral/trivial use, sure (esp. once he'd provided
more detail), but it's not what defines a callback. More generally, a
callback is a means of providing an instance-specific hook into a
general-purpose process (a form of polymorphism, if you like). The simplest
example I can think of is a state machine, where each state corresponds to a
specific processing routine. You can deal with this via a case structure,
sure, but it's neater (and more robust) to use an array of function
pointers.

A more real-world example would be a class that exists to process input from
e.g. a file. Let's say that each "item" in the file is processed by a
general-purpose handler class, but is finally validated and stored by a
routine that is specific to the nature of the item encountered. Within the
uberclass definition one could include a function pointer (the callback);
within the instance of the class one would point this at the specific
routine.

Another example is a registered callback (described by others here), where a
function pointer is passed to a class at runtime (e.g. qsort). I use static
callbacks all the time, but registered callbacks much less so.

Hope this redresses the balance ;).

Steve
http://www.fivetrees.com
Frank Bemelman
2004-12-21 17:03:58 UTC
Permalink
Post by Steve at fivetrees
Post by Frank Bemelman
Post by Steve at fivetrees
What a strange thread. Full of misinformation such as this.
90% of the responses were pretty much okay. That is not 'Full
of misinformation'.
Granted. However the 10% were fairly forceful ;).
Post by Frank Bemelman
Of course you don't bother to give any meaningful response
yourself. Like the majority of CAE, bunch of arrogant, boring
wannabees as they are.
CAE? not sure I know this one (other than Computer Aided Engineering).
It's right under your nose. You are posting in it ;)
Post by Steve at fivetrees
Post by Frank Bemelman
Post by Steve at fivetrees
A callback is a function call to a fuction that at design time does not
yet exist. <<
That's one potential/peripheral/trivial use, sure (esp. once he'd provided
more detail), but it's not what defines a callback.
I have to admit I misread his post first too, thought for a moment he
was talking about stubs or something. But imo he was as close as
it gets.

OTH, what's in a name. All too often we see old wine in new bags.
Post by Steve at fivetrees
More generally, a
callback is a means of providing an instance-specific hook into a
general-purpose process (a form of polymorphism, if you like). The simplest
example I can think of is a state machine, where each state corresponds to a
specific processing routine. You can deal with this via a case structure,
sure, but it's neater (and more robust) to use an array of function
pointers.
A more real-world example would be a class that exists to process input from
e.g. a file. Let's say that each "item" in the file is processed by a
general-purpose handler class, but is finally validated and stored by a
routine that is specific to the nature of the item encountered. Within the
uberclass definition one could include a function pointer (the callback);
within the instance of the class one would point this at the specific
routine.
Perhaps I am misreading here, but this sounds not at all as callbacks.
More like down to earth routing of objects to their specific handlers.
Post by Steve at fivetrees
Another example is a registered callback (described by others here), where a
function pointer is passed to a class at runtime (e.g. qsort). I use static
callbacks all the time, but registered callbacks much less so.
Hope this redresses the balance ;).
I don't know ;) It's getting hairier.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Steve at fivetrees
2004-12-22 05:00:37 UTC
Permalink
Post by Frank Bemelman
Post by Steve at fivetrees
CAE? not sure I know this one (other than Computer Aided Engineering).
It's right under your nose. You are posting in it ;)
Ah. Touché. <embarrassed shuffle>
Post by Frank Bemelman
I have to admit I misread his post first too, thought for a moment he
was talking about stubs or something. But imo he was as close as
it gets.
Hmmm. Will read again. I also thought he was talking about stubs. It's not
at all impossible that I'm missing something.
Post by Frank Bemelman
OTH, what's in a name. All too often we see old wine in new bags.
I'm with you. I've re-read my own definition, don't like it much, and am
regretting getting involved ;).

Which returns me to the deliberate brevity of my first post. What *is* going
on here? This thread has redefined not only callbacks, but "static",
re-entrancy, and the value of Pi [1]. The guys here in comp.arch.embedded
usually really know their stuff... ("bunch of arrogant, boring wannabees as
they are" ;).) Are we being cross-contaminated by sci.electronics.design? Is
it all their fault? [2]

[1] I lied about Pi.
[2] Our newsgroup is better than yours. Rrrrrasp!!

Steve
http://www.fivetrees.com
John Larkin
2004-12-22 05:17:24 UTC
Permalink
On Wed, 22 Dec 2004 05:00:37 -0000, "Steve at fivetrees"
Post by Steve at fivetrees
Which returns me to the deliberate brevity of my first post. What *is* going
on here? This thread has redefined not only callbacks, but "static",
re-entrancy, and the value of Pi [1]. The guys here in comp.arch.embedded
usually really know their stuff... ("bunch of arrogant, boring wannabees as
they are" ;).) Are we being cross-contaminated by sci.electronics.design? Is
it all their fault? [2]
[1] I lied about Pi.
[2] Our newsgroup is better than yours. Rrrrrasp!!
No, it's my fault. I should have remembered that embedded programmers
and electrical engineers never talk.

John
Frank Bemelman
2004-12-22 09:21:17 UTC
Permalink
Post by Steve at fivetrees
Post by Frank Bemelman
OTH, what's in a name. All too often we see old wine in new bags.
I'm with you. I've re-read my own definition, don't like it much, and am
regretting getting involved ;).
Which returns me to the deliberate brevity of my first post. What *is* going
on here? This thread has redefined not only callbacks, but "static",
re-entrancy, and the value of Pi [1]. The guys here in comp.arch.embedded
usually really know their stuff... ("bunch of arrogant, boring wannabees as
they are" ;).) Are we being cross-contaminated by sci.electronics.design? Is
it all their fault? [2]
[1] I lied about Pi.
[2] Our newsgroup is better than yours. Rrrrrasp!!
SED is a mess, and a jolly one at that, so a bit of cross-contamination
won't hurt. I got a bit pissed by CBfalconer plonking Genome, SED's
mascotte. The folks at CAE could loosen up a bit, increasing their
value at the same time. Speff even dropped CAE in his follow-ups from
a few subthreads in this one, never seen him do that on SED. The atmosphere
at CAE is of the arrogant, boring wannabees etc.

;)
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
CBFalconer
2004-12-22 13:09:02 UTC
Permalink
Frank Bemelman wrote:
... snip ...
... I got a bit pissed by CBfalconer plonking Genome, SED's mascotte.
The folks at CAE could loosen up a bit, increasing their value at
the same time. Speff even dropped CAE in his follow-ups from a few
subthreads in this one, never seen him do that on SED. The atmosphere
at CAE is of the arrogant, boring wannabees etc.
Here is the complete message when I PLONKED him. To me, a crude
reply without content to the only worthwhile (to that date) reply
indicates a pure troublemaker. The message ID is:
<_Apxd.607$***@newsfe5-gui.ntli.net>. I challenge you to show
any glimmering of intelligence in that.
Post by Hans-Bernhard Broeker
--
Even if all the snow were burnt, ashes would remain.
You haven't got a fucking clue.......
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
--
Chuck F (***@yahoo.com) (***@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Frank Bemelman
2004-12-22 14:21:17 UTC
Permalink
Post by CBFalconer
... snip ...
... I got a bit pissed by CBfalconer plonking Genome, SED's mascotte.
The folks at CAE could loosen up a bit, increasing their value at
the same time. Speff even dropped CAE in his follow-ups from a few
subthreads in this one, never seen him do that on SED. The atmosphere
at CAE is of the arrogant, boring wannabees etc.
Here is the complete message when I PLONKED him. To me, a crude
reply without content to the only worthwhile (to that date) reply
That might be understandable if you didn't also managed to indirectly
insult other contributors, who posted well before the 20th when
Post by CBFalconer
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
*only*

No netlag excuse here.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Hans-Bernhard Broeker
2004-12-22 15:56:21 UTC
Permalink
[F'up2 cut down, _again_]
Post by Frank Bemelman
Post by CBFalconer
Here is the complete message when I PLONKED him. To me, a crude
reply without content to the only worthwhile (to that date) reply
That might be understandable if you didn't also managed to indirectly
insult other contributors, who posted well before the 20th when
Your newsreader is distorting your view of the world, I think. In a
properly threaded view of this thread, this message by Mr. Falconer
Post by Frank Bemelman
Post by CBFalconer
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
which has you so upset is about the *6th* in the entire thread (and 4
levels deep) not the 20th. If it's 20th in yours, that means you're
using inappropriate tools, and should be very careful using their
results as arguments.
Post by Frank Bemelman
No netlag excuse here.
Terminally sick newsreaders are even less of one. Just because
Web-based "forums" that so many newbies prefer over USENET generally
don't manage to get this anywhere nearly right, doesn't mean we should
degrade USENET in a similar way.
--
Hans-Bernhard Broeker (***@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Frank Bemelman
2004-12-22 16:17:15 UTC
Permalink
Post by Hans-Bernhard Broeker
[F'up2 cut down, _again_]
Post by Frank Bemelman
Post by CBFalconer
Here is the complete message when I PLONKED him. To me, a crude
reply without content to the only worthwhile (to that date) reply
That might be understandable if you didn't also managed to indirectly
insult other contributors, who posted well before the 20th when
Your newsreader is distorting your view of the world, I think. In a
properly threaded view of this thread, this message by Mr. Falconer
Post by Frank Bemelman
Post by CBFalconer
Interesting that you provide this brilliant reply to the only
response to the original that actually was intelligent. PLONK.
which has you so upset is about the *6th* in the entire thread (and 4
levels deep) not the 20th. If it's 20th in yours, that means you're
using inappropriate tools, and should be very careful using their
results as arguments.
I was referring to the date, 20th December, not the place or
level in the thread. Other contributions were posted on the 19th.
Post by Hans-Bernhard Broeker
Post by Frank Bemelman
No netlag excuse here.
Terminally sick newsreaders are even less of one. Just because
Web-based "forums" that so many newbies prefer over USENET generally
don't manage to get this anywhere nearly right, doesn't mean we should
degrade USENET in a similar way.
I don't like those web forums too, for exactly the same reasons.
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Bryan Hackney
2004-12-22 03:57:35 UTC
Permalink
Frank Bemelman wrote:
[...]
Post by Frank Bemelman
90% of the responses were pretty much okay. That is not 'Full
of misinformation'.
That number is getting smaller as the thread gets longer.

[...]
Scott Stephens
2004-12-22 05:31:25 UTC
Permalink
Post by John Larkin
A few programmers I've known have used the term "callback", which
somehow related to executing a deferred subroutine or something. Does
anybody know anything about this term or its conventions? If I google
it, I just get a lot of telephone-type references.
I'm doing a thing now where, in an interrupt service routine, if I
think I'm out of time I set a flag to remind me to finish some chores
next time or so. I'm not sure if that qualifies as a "callback."
I wouldn't call it a callback. If you are instancing a bunch of objects,
you pass them a function (java-method) pointer (java-instance variable)
so they can activate a function in the instancing routine.

For instance, I have a software scope, I push a button to instance a
plot, and pass each plot-object an instance of a trace object-variable
(pointer), and a handle or pointer to the main scope program which
refreshes it.

What your talking about sounds like a flag. Unless you are doing
object-oriented programming on microcontrollers =)
Continue reading on narkive:
Loading...