what's a callback? - Page 7

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: what's a callback?

Quoted text here. Click to load it


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.


Re: what's a callback?

Quoted text here. Click to load it

In Java, COM, DCOM, OLE, etc., they are called interfaces. In C++,
"prototype" and "function declaration", are synonymous. A function
name without parameters is a pointer, but you can also declare a
variable name for a pointer to a function with a... call it a
special syntax. You knew that, right?

ActiveX really is a good way to write reusable code - DLLs on
steroids. And the remote access (DCOM+/RPC) capability is the balls.
Version control is a positive side benefit of the whole
architecture. It's still a mess - a miracle that MS could pull it
off IMO.

DHTML isn't a COM thing, it's a DOM thing.
--
Best Regards,
Mike

Re: what's a callback?

Quoted text here. Click to load it


No, kind of fuzzy on C++, mostly into Java.

Quoted text here. Click to load it

Widgets (COM, Active-X) you code aren't part of the DHTML DOM, but can
be scripted as if they were.


Re: what's a callback?
Quoted text here. Click to load it

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)







Re: what's a callback?
Quoted text here. Click to load it

Granted. However the 10% were fairly forceful ;).

Quoted text here. Click to load it

CAE? not sure I know this one (other than Computer Aided Engineering).

Ok - meaningful response then. Rene said:
Quoted text here. Click to load it
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



Re: what's a callback?
Quoted text here. Click to load it

It's right under your nose. You are posting in it ;)


Quoted text here. Click to load it

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.

Quoted text here. Click to load it
simplest
a
from

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.

Quoted text here. Click to load it
a
static


I don't know ;) It's getting hairier.

--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)





Re: what's a callback?
Quoted text here. Click to load it

Ah. Touché. <embarrassed shuffle>

Quoted text here. Click to load it

Hmmm. Will read again. I also thought he was talking about stubs. It's not
at all impossible that I'm missing something.

Quoted text here. Click to load it

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



Re: what's a callback?
On Wed, 22 Dec 2004 05:00:37 -0000, "Steve at fivetrees"


Quoted text here. Click to load it

No, it's my fault. I should have remembered that embedded programmers
and electrical engineers never talk.

John



Re: what's a callback?
Quoted text here. Click to load it
going
as
Is

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)











Re: what's a callback?
Quoted text here. Click to load it

That might be understandable if you didn't also managed to indirectly
insult other contributors, who posted well before the 20th when
you posted this:

Quoted text here. Click to load it

*only*

No netlag excuse here.

--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)








Re: what's a callback?
[F'up2 cut down, _again_]


Quoted text here. Click to load it


Your newsreader is distorting your view of the world, I think.  In a
properly threaded view of this thread, this message by Mr. Falconer

Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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 ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: what's a callback?
Quoted text here. Click to load it

I was referring to the date, 20th December, not the place or
level in the thread. Other contributions were posted on the 19th.

Quoted text here. Click to load it

I don't like those web forums too, for exactly the same reasons.

--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)



Re: what's a callback?
[...]
Quoted text here. Click to load it

That number is getting smaller as the thread gets longer.

[...]

Re: what's a callback?

Quoted text here. Click to load it

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 =)


Re: what's a callback?
If a cold reading, screen test or other audition is successful, you
will get a callback.

Every actor in LA and NY will tell you that.  The majority of people on
this thread are morons.


Now, there's also this fringe use of the term used by "computer
programmers", whatever that means.  Basically, if you call a function
with a pointer to one of your own function, such that your function
will be called at some time either synchronously (a-la qsort) or
asynchronously (a-la signal(), or interrupt or button-press) then that
target function is a callback.


An interrupt is a low-level callback, of sorts.
A POSIX signal handler is a callback, of sorts.
The qsort comparator is a callback.
Basically any "registered" or "plug-in" function call is a callback.  A
callback can be used within a module or library for its own purposes or
used as a mechanism to call external functions.

A virtual function in a child class is not, by definition, a callback,
but the overall observer framework may use it like a callback, so for
example you can have a CButtonObserver class with a buttonPress()
method.

So if a framework defines a non-local control flow, where an
application's functions are called somewhat asynchronously, then
callbacks are used.

So if I pass a library a pointer to function X, but that library has no
knowledge of function X other than the fact that it now has a pointer
to it... and at some point the library calls function X, then X is a
callback.  This is what I mean by non-local control flow.  X is not
part of the core library implementation (a-la qsort), it's an
externally provided function.

God damn it.


There are three types of programmer: Those who can use "callback"
without having to write an essay, those like me who will write an
essay, but still not articulate it clearly, and those who just write a
10 line "C" program so that other's go, "Oh, yeah... I see it.".


Re: what's a callback?

Quoted text here. Click to load it

Well, sure. What's wrong with that?

Quoted text here. Click to load it

But not if the vector is determined at compile time, right?

Quoted text here. Click to load it

So I guess I'm not a programmer. OK.

John


Re: what's a callback?

Quoted text here. Click to load it

Of sorts... even if it's a static vector, as it implements a non-linear
program flow back to the "application's" code.

Quoted text here. Click to load it
a

Judging by the length of this thread and your post count, I think it's
clear which group you're in ;-)


Re: what's a callback?
What you're referring to very much the not-so-critical "bottom half"
popular in Linux.
My usage of callback is a usr function with its args which I append
into a call-back queue at every ISR and at end of the ISR I raise a
lower priority s/w interrupt which checks the callback queue and
executes any function(s) it finds.
The (substatial) usr fn is thus called from a lower proirity ISR thus
preventing it from hogging the real ISR.
K V Abhilash

John Larkin wrote:
Quoted text here. Click to load it


Site Timeline