FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

D equiv - typedef of a function pointer

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
nicfellows



Joined: 13 May 2004
Posts: 1
Location: Newcastle

PostPosted: Thu May 13, 2004 5:54 am    Post subject: D equiv - typedef of a function pointer Reply with quote

Hi

I am trying to convert a C header to a D module, mainly to get some D experiance. I have come up against a typedef to a function pointer and dont know how to code it.

The expression is like this:

Code:
typedef int (*func_name)(struct a_type *arg1, struct a_type *arg2);


Can anyone help, or point me to info? I cant seem to find anything similar in the tutorials.

Thanks
Nic
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Thu May 13, 2004 6:11 am    Post subject: Re: D equiv - typedef of a function pointer Reply with quote

nicfellows wrote:
Code:
typedef int (*func_name)(struct a_type *arg1, struct a_type *arg2);


It becomes...

Code:
alias int function(a_type*, a_type*) func_name;


Just replace 'alias' with 'typedef' if you want it strongly typed.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General 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