Go to Post My only question is, Can your robot place tetras and deliver Krispy Kremes to team mentors in autonomous mode? - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-12-2008, 03:49
shavol shavol is offline
Registered User
AKA: Shahar Givol
no team (Elysium)
Team Role: Alumni
 
Join Date: Jan 2008
Rookie Year: 2007
Location: israel
Posts: 1
shavol is an unknown quantity at this point
definition of FUNCPTR

Hello, I am looking at the WPIlib code and have a question

in task.h line 39 I found the variable type 'FUNCPTR' and I didn't found the definition of it in the project, do you know what is the definition of it?

thanks a lot,
team 1937.
  #2   Spotlight this post!  
Unread 12-12-2008, 07:35
jtdowney jtdowney is offline
Boiler Up
AKA: John Downey
FRC #4302 (Robophins)
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Chicago
Posts: 300
jtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant future
Re: definition of FUNCPTR

I am not certain which file it is defined in but what it is is a function pointer. It allows you to pass around a reference to functions of the same signature (same return type and parameter types). Function pointers are often used for callbacks where you will provide some function a pointer to a function they should call when some event happens. Wikipedia has a pretty good overview in their Function pointer article.
__________________
John Downey
Lead Robot Inspector - Purdue IndianaFIRST District
Whitney Young Magnet High School/Robophins (FRC 4302) - Mentor (2013-current)
Midwest Regional Planning Committee - Member (2012-current)
Boilermaker Regional Planning Committee - Member (2011-2014)
Robot Inspector (2008-current)
Purdue FIRST Programs - Staff Advisor (2008-2011)
Lafayette-Jefferson High School/Precision Guessworks (FRC 1646) - Mentor (2006-2011)
  #3   Spotlight this post!  
Unread 12-12-2008, 08:14
2roy999 2roy999 is offline
Registered User
FRC #1937
 
Join Date: Dec 2008
Location: Modi'in
Posts: 3
2roy999 is an unknown quantity at this point
Re: definition of FUNCPTR

Hello, I read what you wrote and I have a question

How can I know the return type of the function and the type of the function's arguments?

thank you,
Team 1937
  #4   Spotlight this post!  
Unread 24-12-2008, 15:46
GabeRC1717's Avatar
GabeRC1717 GabeRC1717 is offline
Registered User
FRC #1717 (D'Penguineers)
Team Role: Student
 
Join Date: Oct 2008
Rookie Year: 2009
Location: Goleta
Posts: 9
GabeRC1717 is on a distinguished road
Re: definition of FUNCPTR

Code:
typedef int (*FUNCPTR)(...);
You can have up to ten arguments, they have to be of the type "int", see taskSpawn
__________________
----------
Gabe
grivescorbett@dpengineering.org
Team 1717, http://dpengineering.org
  #5   Spotlight this post!  
Unread 27-12-2008, 06:06
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: definition of FUNCPTR

Soo... a function pointer holds the address of a function, it's arguments and return type?
__________________
TEAM 2230 ZECHARIA'S ANGELS

2009 Microsoft Israel FRC Regional Winners!
2009 Microsoft Israel FRC Regional Chairman's Award Winners!!!
---------------------------------
2008 Microsoft Israel FRC Regional semi-finalist.
2008 Microsoft Israel FRC Regional Delphi's "Driving Tommorow's Technology" Award winner.
2008 Robot Driver
---------------------------------
2007 GM/Technion Israel FRC Regional semi-Finalist.
2007 GM/Technion Israel FRC Regional Xerox Creativity Award winner.
2007 Robot Driver.
  #6   Spotlight this post!  
Unread 27-12-2008, 07:19
jtdowney jtdowney is offline
Boiler Up
AKA: John Downey
FRC #4302 (Robophins)
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Chicago
Posts: 300
jtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant future
Re: definition of FUNCPTR

Quote:
Originally Posted by Bomberofdoom View Post
Soo... a function pointer holds the address of a function, it's arguments and return type?
Close, it is just the address of the function. You define the types for the parameters and return and the compiler will setup the function call correctly for you. It will also (if it can) double check that you are calling the function with the correct signature (signature being types of return and parameters) to prevent simple mistakes.
__________________
John Downey
Lead Robot Inspector - Purdue IndianaFIRST District
Whitney Young Magnet High School/Robophins (FRC 4302) - Mentor (2013-current)
Midwest Regional Planning Committee - Member (2012-current)
Boilermaker Regional Planning Committee - Member (2011-2014)
Robot Inspector (2008-current)
Purdue FIRST Programs - Staff Advisor (2008-2011)
Lafayette-Jefferson High School/Precision Guessworks (FRC 1646) - Mentor (2006-2011)
  #7   Spotlight this post!  
Unread 28-12-2008, 19:00
Dbruce1792 Dbruce1792 is offline
Registered User
FTC #0130
 
Join Date: Sep 2008
Location: Windsor, CT
Posts: 3
Dbruce1792 is on a distinguished road
Re: definition of FUNCPTR

Quote:
Originally Posted by GabeRC1717 View Post
Code:
typedef int (*FUNCPTR)(...);
You can have up to ten arguments, they have to be of the type "int", see taskSpawn
Can't the int be typecast as a float, etc.?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pwm definition problems Anton Programming 4 02-02-2005 13:01
Its-Definition Please archiver 2000 4 24-06-2002 00:08
Definition of aluminum extrusion...? kangarue23 Technical Discussion 4 25-01-2002 16:53


All times are GMT -5. The time now is 03:16.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi