TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1996-01-14 17:40:30
subject: Re: Realloc

KH> where cur_arr_size is something like 110..
KH> when it should have been
KH> realloc(fareas,cur_arr_size * sizeof(FA));
FA>                     ^^^^^^^^^^^^   ^^^^^^^^^^

FA> Don't forget to cast those to a long, if the allocated memory goes passed 
FA> 655?? i forget:)..
FA> it'll wrap around to 0 and that's what you'll allocate.Hence bye-bye data.

65535 is the maximum you can store in an unsigned 16 bit field.
However, what you said above is not correct.  realloc takes
as a parameter a size_t value.  sizeof returns a size_t value.
that is quite sufficient.  If size_t only gets up to 65535, 
then that's all you're going to get anyway, no matter how many
times you cast it to a long.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.