atom feed20 messages in org.freebsd.freebsd-hackersC programming question
FromSent OnAttachments
MattApr 4, 2005 11:43 am 
Devon H. O'DellApr 4, 2005 11:49 am 
Marc OlzheimApr 4, 2005 11:49 am 
Joerg SonnenbergerApr 4, 2005 11:51 am 
Dan NelsonApr 4, 2005 11:55 am 
Mike MeyerApr 5, 2005 4:50 am 
gilles chehadeApr 5, 2005 4:50 am 
Dunceor .Apr 5, 2005 4:50 am 
ra...@redshift.comApr 5, 2005 5:25 am 
Peter JeremyApr 7, 2005 1:36 am 
Stijn HoopApr 7, 2005 1:39 am 
ra...@redshift.comApr 7, 2005 1:50 am 
ra...@redshift.comApr 7, 2005 1:51 am 
Zera William HolladayApr 7, 2005 7:24 am 
Robert WatsonApr 7, 2005 12:08 pm 
Michael ShalayeffJul 7, 2005 12:08 pm 
chatonJul 7, 2005 12:08 pm 
Juan J. MartínezJul 7, 2005 12:10 pm 
Juan J. MartínezJul 7, 2005 12:10 pm 
Mike MeyerJul 8, 2005 12:25 pm 
Subject:C programming question
From:Michael Shalayeff (mic@lucifier.net)
Date:Jul 7, 2005 12:08:55 pm
List:org.freebsd.freebsd-hackers

Making, drinking tea and reading an opus magnum from Juan J. [Mart_nez]: [Charset ISO-8859-1 unsupported, filtering to ASCII...]

El lun, 04-04-2005 a las 11:43 -0700, Matt escribis:

[...] Can someone break down these declarations (if that's what they are)? Is this a form of typecasting? Thanks for your help.

Those are declarations of pointers to functions.

/* real function */ void dumb(int a) { return a; }

warning: `return' with a value, in function returning void

...

/* here follows a declaration of func pointer */ int (*func_ptr)(int); int a;

/* assign it */ func_ptr=dumb;

warning: assignment from incompatible pointer type

/* use it */ a=func_ptr(123);

Any good book about C should cover this. Look for OOP in C also, it's frequent use pointers to functions + structs to add classes to C.

perhaps you should read that book first (:

cu