Tanks everyone for answering on this so much... Comment/Question below,
On 09/06/2011, at 4:56 AM, Kevin Jones wrote: > I really don't understand what this means: > > typedef struct object *(*method_t)(struct object *receiver, ...); > > method_t is a pointer to a function that returns an object pointer and takes > receiver and additional argument Thanks for this. Okay, I understand that, but why is there a "struct" in there twice? considering object is defined as a struct earlier in the piece... is it because they're object pointers? when specifying a struct pointer, do you need to write "struct" even though you've previously specified a struct with that name? ... struct vtable; struct object; struct symbol; typedef struct object *(*method_t)(struct object *receiver, ...); ... This is my reasoning... a function pointer "fp" to a function returning an int and taking an int "h" as an argument is as follows: int (*fp)(int h); Now, a function pointer "fp2" to a function returning a pointer to an integer, taking an integer pointer "x" as an argument would go like this in my mind: int *(*fp2)(int *x); Does typedef require that "struct" is included as part of its syntax? My god, C obfuscates meaning and intention so "well". <sigh> It was one of my first programming languages, yet I still find it incredibly difficult. I guess it's just me coming to the sad realisation that I need to know C (and Math) much better. Julian.
_______________________________________________ fonc mailing list [email protected] http://vpri.org/mailman/listinfo/fonc
