discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function pointer


From: Richard Frith-Macdonald
Subject: Re: function pointer
Date: Mon, 31 Jul 2006 16:02:30 +0100


On 31 Jul 2006, at 15:30, hns@computer.org wrote:

I want to set a function pointer passing it to an object. I think it
would be something like this

-(int) setPotential: (double)(*potential)(double r, void * par);

The correct syntax of Objective-C should be which makes it impossible
to specify function pointers directly:

I don't understand the above sentence.

I guess what you mean is that the format for specifying the type of a method argument in objective-C is identical to the way you specify a typecast in C.

eg. where in C you might say

 (double (*)(double r, void * par)) aPointer

to cast aPointer to be of type '(double (*)(double r, void * par))'

and in Objective-C you might say

- (id) aMethodName: (double (*)(double r, void * par)) anArgument;

to declare anArgument to be a value of type '(double (*)(double r, void * par))'






reply via email to

[Prev in Thread] Current Thread [Next in Thread]