I am not really a c++ expert so I dont know if this is a language thing, or specific to the photon / cloud build system
In my header file I can group return codes like this
But this doesn’t work how I would expect when the return is a pointer
The compiler thinks func1 returns a mystruct* correctly
But it thinks func2 returns a non pointer mystruct
This is super weird to me
Just avoid this syntax. It’s not good C coding style to define more than 1 function prototype per statement. Put each one on its own line with the return value repeated.
Totally agree with @jvanier above. It’s best avoided. But for completeness if you really wanted to make it work, then you’d have to prefix the 2nd and later functions with
*, or use a
typedef int* p_int and declare the return type as
But keep in mind it’s not considered good practice, so best avoided!