Just have a query about how 'int' is handled in libraries with overloaded functions, which are to be used on Arduino boards where some handle the 'int' as 16bit and some handle the int as 32bit.
What is the normal method for handling this?
We have a library we are writing which we have a function which is overloaded, each taking a parameter of int16_t, int32_t and float, and the compiler (in this case for the Pi Pico) doesn't know where to assign the int that is going into the function, to which overloaded function etc.
Typecasting the input to int32_t works, but I am just curious about what is the normal practice for handling this type of thing for libraries which support many Arduino boards which handle the type 'int' differently.
but if someone uses say a constant value, then we get an error when compiling of it being ambiguous etc.
I think its possible an issue we need to handle in the demo, not in the library as such, I am not sure, just trying to get my head around how to get the compiler (likely different compilers) how to handle 'int' if really its int16_t for one and int32_t for the other.
On an 8-bit AVR, an 'int' is 16 bits (int16_t). On an ARM or ESP processor, it's 32 bits (int32_t). The compiler should be able to figure it out. For further advice, post your actual code and the actual error messages - not your paraphrased version of them.
From some experimenting it looks like you get an "ambiguous" error when there is no exact match and more than one conversion possible. Either add functions for the inexact matches or cast the values to an exact match.