Re: Help needed with function pointer examples

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Tue, 17 Jan 2012 16:28:38 +0100

          From comp.compilers

Related articles
Help needed with function pointer examples swatirathi@cse.iitb.ac.in (Swati) (2012-01-06)
Re: Help needed with function pointer examples ulimakesacompiler@googlemail.com (Uli Kusterer) (2012-01-15)
Re: Help needed with function pointer examples gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-01-15)
Re: Help needed with function pointer examples torbenm@diku.dk (2012-01-16)
Re: Help needed with function pointer examples arnold@skeeve.com (2012-01-16)
Re: Help needed with function pointer examples DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-01-17)
Re: Help needed with function pointer examples dot@dotat.at (Tony Finch) (2012-01-19)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Tue, 17 Jan 2012 16:28:38 +0100
Organization: Compilers Central
References: 12-01-006 12-01-026 12-01-029
Keywords: OOP
Posted-Date: 17 Jan 2012 11:21:04 EST

Torben Fgidius Mogensen schrieb:
> The moderator opined:
>> [Any program written in an OO language that allows inheritance or
>> overloading uses function pointers, since that's how they're
>> implemented. -John]
>
> If the inheritance and overloading can be resolved statically, function
> pointers are not needed. But most OO languages use dynamic method
> resolution by default, so what you say applies to nearly all OO
> implementations.


IMO the key is *virtual* methods, which require dynamic lookup in a
Virtual Method Table or similar structure.


In non-OO languages calling conventions like "call by name" also can
require dynamic lookup of function addresses.


Sorting and searching algorithms also typically are implemented with a
compare function (pointer) argument.


DoDi



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.