D
dillogimp
hi
This code is taken from a lisp interpreter by Andru Luvisi.
typedef struct obj {
enum otype type;
struct obj *p[1]; // array of pointer, sizeof(obj)=8
} obj;
typedef obj * (*primop)(obj *);
obj *all_symbols, *top_env, *nil, *tee, *quote,
*s_if, *s_lambda, *s_define, *s_setb;
Can someone explain what is "typedef obj * (*primop)(obj *);"?
The subsequent line is for a bunch of pointers to "obj" that I
understand.
I understand "typedef" is like alias.
"typedef a b" is like "b is of an alias for a"
The way the code is written, I can't tell what is being aliased.
"(*)" usually means pointer to function that I understand,
My guess is:
// primop is a pointer to a function that takes (obj*) and returns
"obj*"
If that is correct, what is being aliased? Thanks.
This code is taken from a lisp interpreter by Andru Luvisi.
typedef struct obj {
enum otype type;
struct obj *p[1]; // array of pointer, sizeof(obj)=8
} obj;
typedef obj * (*primop)(obj *);
obj *all_symbols, *top_env, *nil, *tee, *quote,
*s_if, *s_lambda, *s_define, *s_setb;
Can someone explain what is "typedef obj * (*primop)(obj *);"?
The subsequent line is for a bunch of pointers to "obj" that I
understand.
I understand "typedef" is like alias.
"typedef a b" is like "b is of an alias for a"
The way the code is written, I can't tell what is being aliased.
"(*)" usually means pointer to function that I understand,
My guess is:
// primop is a pointer to a function that takes (obj*) and returns
"obj*"
If that is correct, what is being aliased? Thanks.