(*((_SINGARR) _receptive->__m2dimensio g_curr )) = (_SINGARR) malloc(sizeof(*((_SINGARR)(_generic)) * g));
the aforementioned produces the following compiler warning "assignment makes integer from pointer without a cast "
I suppose it's somehow procured by the sizeof
operator evaluation of the typecasted dereferenced void* or am I just not dereferencing accordingly?
_generic
is a void*
method parameter
_receptive
- typedef struct*
method parameter used in the accessing of its 2D-array property (also pseudo-generic)
expanded directives
_SINGARR char*
CodePudding user response:
When you expand all the stuff, it looks like
* (char*) p = (char*) malloc(...);
This means, there is a pointer on the right side (char*)
and a character (*(char*)
, integer type) on the left side.
Now the warning message becomes clearer:
assignment makes integer (the part on the left side of the assignment) from pointer (the part on the right side of the assignment) without a cast
Unrelated, but expanding the sizeof(...)
part will become sizeof(*((char*)(_generic)) * g)
, which in turn is sizeof(<some character value> * g)
, which in turn will become sizeof(<some integer value>)
, which is sizeof(int)
and finally becomes 4 or 8 bytes depending on the architecture of your machine.