Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pointer to function #26

Open
LabZDjee opened this issue Sep 30, 2018 · 0 comments
Open

pointer to function #26

LabZDjee opened this issue Sep 30, 2018 · 0 comments

Comments

@LabZDjee
Copy link

As main gets strings as arguments, it would be interesting to transform some of those strings into calls to functions (for example, associating those strings to function pointers in a lookup array). However, I could find not way to express a pointer to function and run it. For example, let's take a function which takes an int and returns an int. In C, a typedef is usually declared:

typedef int (*pFct)(int);

This construct is unsupported. Moreover, defining a function with such a pointer-to-function is unsupported either. E.g.:

int executeMe(int(*pFct)(int), int val) {return pFct(int);}

Is there a workaround? It could significantly improve scripts in an constrained embedded environment.

If not, and if you can suggest where in the source code this feature could be implemented, I would be happy to try this myself. But maybe this is a fundamentally tough undertaking...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant