codeplea/tinyexpr

warning: ISO C forbids conversion of function pointer to object pointer type

stcmeh opened this issue · 0 comments

I think that this warning arises because some CPU architectures have different memory bus sizes for code memory and data memory. Your code uses a single pointer to point to either functions or data with a second flag to indicate what the pointer means. The use of a single pointer type (void *) causes the compiler warning.

I tried just doing simple type-casting e.g. on line 161:

{"abs",   (void *)fabs,   TE_FUNCTION1 | TE_FLAG_PURE, 0},

But that didn't work.

Maybe a union would work? Not sure. Or you'd need to have two pointers in te_variable.

As far as I know the code still works but it creates lots of warnings.

Thanks for any help with this.