Skip to main content
GameDev.net gamedev.net
🔒 Locked

Does this function pointer make sense?

Started by Sagar_Indurkhya Apr 22, 2006 at 2:25 PM 5 replies 900+ views
Original Post
Sagar_Indurkhya
Sagar_Indurkhya
I've been trying to get this right but I am having a lot of trouble: double (*inputFunc)((list) &); this is suppose to be a function pointer to a function that might look like:

double haha(list<double> &x)
{
  // do stuff to x
  return 0.0;
}


Is this correct? The compiler disagrees with me, but I don't know what I should do to correct it(and I have not had too much exposure to function pointers).
Programmer One
Programmer One
Quote:
Original post by Sagar_Indurkhya
double (*inputFunc)((list) &);


Well thar's yar problem. You forgot yar typedef.

typedef double (*inputFunc)((list) &);

Coward
Coward
Maybe the GP forum would be more apropriate?
Don't Temp Fate..
CTar
CTar
Quote:
Original post by Programmer One
Quote:
Original post by Sagar_Indurkhya
double (*inputFunc)((list) &);


Well thar's yar problem. You forgot yar typedef.

typedef double (*inputFunc)((list) &);


Shouldn't it be:
typedef double (*inputFunc)(list<double>&);

Without the extra parentheses?
nilkn
nilkn
I'll go ahead and throw out the obligatory recommendation for boost::function. Also, it would clean up your code a bit if you utilized the awe-inspiring power of the typedef mechanism: typdef list DoubleList.
Sagar_Indurkhya
Sagar_Indurkhya
It worked! Thanks.

Sorry that its in the lounge, I thought I was in General Programming when I put it up.
LessBread
LessBread
Quote:
Original post by Coward
Maybe the GP forum would be more apropriate?


Yes.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.