delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/08/04:13:21

Date: Thu, 8 Nov 2001 11:07:23 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Raf256 <raf256 AT go2 DOT pl>
cc: djgpp AT delorie DOT com
Subject: Re: sizeof void* ?
In-Reply-To: <Xns91533B07D431Braf256civ@193.219.28.2>
Message-ID: <Pine.SUN.3.91.1011108110625.10953O-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 8 Nov 2001, Raf256 wrote:

> I have memor area like :
> void *ptr = malloc(1024);
> realloc(ptr, ???);
> 
> how can I here check current size of memory block that begins in ptr ?

You can't; not portably, anyway: there's no standard function to return 
that info.

The usual technique is to store the allocated size in a separate 
variable.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019