Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Who needs functional programming...

Name: Anonymous 2015-07-27 20:45

... when C has function pointers?

Name: Anonymous 2015-07-28 10:03

>>8
Shouldn't this work fine?
struct fp
{
struct fp *(*func)(void *);
};


C doesn't even have a generic function pointer type on all implementations
I fail to see how a generic function pointer would be of use, but you can always return a void * that you then cast into a pointer to a struct that contains the function pointer you want.

Name: Anonymous 2015-07-28 20:24

In the end it's just easier to use

void* (*fp)(...);

and cast the return value.

Name: Anonymous 2015-07-28 20:43

>>8
C doesn't even have a generic function pointer type on all implementations
void (*)()
// or anything really

any function pointer can be cast to any other function pointer and back again, and it shall be equal to the original pointer.

Name: Anonymous 2015-07-28 20:56

>>16
That's cause C is untyped. Not unityped like Phython or Rabbi or Scheme, but untyped like fucking assembly.

Name: Anonymous 2015-07-28 21:22

>>18
§ 6.3.2.3
``A pointer to a function of one type may be converted to a pointer to a function of another type and back again; the result shall compare equal to the original pointer.´´

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List