This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]