I have a class with a generic function and one void pointer ans an argument.
typedef void (*GFunc)(void*); //Function pointer for MenuItem
Now, the only case I had issues passing the pointer around was when I tried to write my error class that prints to the screen of my project. I wanted to allow for custom error/warning text to be put in when the class is instantiated, but when I typed in a string like
"someString" as an argument I got the compiler error of
invalid conversion from 'const void*' to 'void*' [-fpermissive]
This is obviously because the default behavior of double quotes is to generate a const char*, and then in the process of conversion it changes from char to void before realizing there's a const keyword.
I got around the issue by casting it like so: `(void*)"someString"
Now, I realize this is terrible, hacky, and probably exceedingly dangerous, but I wanted to know exactly how bad a sin I'm committing. It appears to work, and for all of my testing I can't find anything wrong, but I'm working on platform with around 4MB of memory so I don't know if I'm just not seeing the effects of memory fragmentation or if it's fine, just weird.
Is anyone familiar with what this will do to my poor little microcontroller?