For the code :
static const char *a = NULL;
abc((char **)&a);
abc method is defined as :
abc(char** a)
I get error (warning treated as error) as :
error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
To fix this , i added :
#ifdef _PTR_CAST_
#define SIZE_T_CAST uintptr_t
#else
#define SIZE_T_CAST size_t
#endif
My problem is , should the api call be
abc( (char **)(SIZE_T_CAST)&a); or
abc( (char **)(SIZE_T_CAST *)&a);
It doesnot complain for both , but what is the correct way ?