This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
warning: assignment makes pointer from integer without a cast
- From: "Manal Helal" <manalorama at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 28 Jan 2007 14:30:03 +1100
- Subject: warning: assignment makes pointer from integer without a cast
Hi
I am doing a realloc as follows:
structArray[i].innerarray = realloc (structArray[i].innerarray,
structArray[i].innerarraySize * sizeof *(structArray[i].innerarray));
where I am changing the size of the inner array (defined as (int *)in
the structure array, to the new size structArray[i].innerarraySize,
and it is giving me:
warning: assignment makes pointer from integer without a cast
please let me see where is the integer in this, realloc should return
a pointer, and the inner array is a pointer to integer, and I just
learned that new compilers don't require casting from malloc, realloc
and so
when I added the casting, it worked fine,
Will you please explain to me whether we should do casting or not, and
with which memory allocation functions,
I am using:
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
thank you very much, I appreciate your help,
--
Kind Regards,
Manal Helal