🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5889

Re: Callback mechanics

#5889
From: Andrue Cope [TeamB]
Date: Thu, 23 Jun 2005 08:10
30 lines
2328 bytes
Remy Lebeau (TeamB) wrote:

> No, it is not "bound" to anything.  A callback is nothing more than a
> function call, period.

This is of course technically correct but these days I have gone back
to viewing a callback /function/ as a special kind of function. My
reasons for this stem from a handful of bad experiences resulting from
my own library's early design where callbacks were retained for
indefinite amounts of time.

We had scenarios where a file handling object would be created and
passed a callback in its ctor. It then retained this callback and could
call it at any point it wanted to for the duration of its own instance.
Quite literally the callback could lie dormant for hours before
suddenly getting called.

As I mentioned in my reply we now use a dedicated callback class to try
and help mitigate this issue.

Yes, technically, from the CPU POV a callback is just a function but
from a developer's POV (IMO) a callback function is a piece of code
that can be called at any moment in any context. That makes it
different to most functions which only get called as part of an easily
deterministic sequence of logic flow.

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <42ba6e6d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42b7fc1d$1@newsgroups.borland.com> <42b84cd0$1@newsgroups.borland.com> <k60hb19l3b2jr36alinqvjlqkqgsrecd3j@4ax.com> <42b903e1$1@newsgroups.borland.com> <vcrib197a9l8hpe8flhmrf2b8ae0m5mdu9@4ax.com> <42b9c05a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bcabb6910c82b605
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: Callback mechanics
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42b7fc1d$1@newsgroups.borland.com> <42b84cd0$1@newsgroups.borland.com> <k60hb19l3b2jr36alinqvjlqkqgsrecd3j@4ax.com> <42b903e1$1@newsgroups.borland.com> <vcrib197a9l8hpe8flhmrf2b8ae0m5mdu9@4ax.com> <42b9c05a$1@newsgroups.borland.com>
Date: Thu, 23 Jun 2005 09:10:19 +0100
User-Agent: XanaNews/1.17.5.3
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <42ba6e6d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1119514221 217.207.223.34 (23 Jun 2005 01:10:21 -0700)
Lines: 30
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail