CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Function pointers

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
meebee
Guest







Function pointers
PostPosted: Thu May 20, 2004 7:52 pm     Reply with quote

PCH version 3.158

I wanted to write a dispatcher function, with an array storing pointes to callback functions. Given a certain event I wanted to call the appropriate callback function.
Unfortunately it seems that the pic c compiler doesnt support function pointers. E.g:

void do_nothing() {}

void main() {
void (*p)();
p = do_nothing;
p();
}

Gives me this error message:
Error 117: Improper use of a function identifier.

Did I miss something or is the compiler not capable with dealing of function pointers? Is there any workaround for this?

Any help appreciated,
Michael
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Thu May 20, 2004 7:56 pm     Reply with quote

According to the readme.txt your version just misses pointer-to-function implementation. That as V3.160.

That said, it doesn't work that well (in my opinion) in any version since 3.160. Not sure how far back the discussion was (use the search feature to look for "function pointer" or "pointer to function") but PCM Programmer, RJ Hamlet, myself and probably a dozen others went back and forth about function pointers.

OK - editing the post because I found a few links.

The one I was remembering is
http://www.ccsinfo.com/forum/viewtopic.php?t=6843&highlight=pointer+function

And another promising one is
http://www.ccsinfo.com/forum/viewtopic.php?t=18345&highlight=function+pointer
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
meebee



Joined: 21 May 2004
Posts: 2

View user's profile Send private message

PostPosted: Fri May 21, 2004 1:28 am     Reply with quote

Thanks for your quick reply.

I'll try v3.188 and see if it works (v3.190 seems to have many problems).
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon May 24, 2004 9:01 am     Reply with quote

look at pointer to funtion in CCS FAQ. They have a way to do it.
somewhat.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group