Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/08/07 16:17
Modified:
  11/08/07 16:26

Read: times


 
#146782 - Function pointers and stuff
Responding to: ???'s previous message
As this is a re-post of an existing topic, you should give a link to what's been said already:

http://www.8052.com/forum/read.phtml?id=146774

Please also look at the instructions on how to post source code, and note the 'Insert Code' button:
http://www.8052.com/faqs.phtml?FAQ=120199

Cyrille Ngassam said:
I know that in C is pointers important fur speed.

No, that's not true.

In any language, indirection will always be slower than direct access!

I agree that for variable are pointers important but why therefor use pointers to function?

You'd use a function pointer where you didn't know what function you'll be calling at compile time.
eg, they are commonly used for Call-backs in APIs, Operating Systems, etc.

Another common use is in Tables of Function pointers to implement finite state machines

I tought the same of pointers of pointers. why and when must we use pointers of pointers ?

There's no compulsion about it - you just use them where they provide the most appropriate solution to the problem at hand!

here ist an exemple :

That looks like an example of a linked-list - nothing to do with function pointers there?

Take a look at this thread: http://www.keil.com/forum/docs/thread11072.asp

See also: http://www.8052.com/forum/read.phtml?id=146784


List of 11 messages in thread
TopicAuthorDate
C : pointers of function und pointers of pointers            01/01/70 00:00      
   Function pointers and stuff            01/01/70 00:00      
   Parameter passing in C            01/01/70 00:00      
   C FAQ            01/01/70 00:00      
   Function pointer demo            01/01/70 00:00      
      Heads up            01/01/70 00:00      
         True            01/01/70 00:00      
            I use function pointers all the time            01/01/70 00:00      
               void-void function pointers need not be slow            01/01/70 00:00      
                  correct, with a caveat            01/01/70 00:00      
   thank you all.            01/01/70 00:00      

Back to Subject List