Re: Rallocating a struct * *

From: Sheldon Simms (sheldonsimms_at_yahoo.com)
Date: 11/07/03


Date: Fri, 07 Nov 2003 11:21:18 -0500

On Fri, 07 Nov 2003 06:50:35 -0800, Henrik J wrote:

> Hello..!
>
> I have this problem:
> Following shows allocation of my struct:

C++ code snipped

> 44 times that dosn't make sense...

After converting your code to C, I was able to realloc 45
times. If your intention is to write C (and not C++), then
try to post a minimal complete (compilable!) program that
demonstrates your problem. Then we'll be better able to help
you out.

-Sheldon



Relevant Pages

  • Re: Strange problem with semaphores and localtime_r function.
    ... The localtime_r function thinks a 'struct tm' ... it will exceed 'sizeof' as reported by your header files. ... The next memory allocation will happen inside ...
    (comp.unix.programmer)
  • Re: When to check the return value of malloc
    ... when constructing a Workforce, we set up the names array correctly, and ... struct workforce { ... Since two containers need allocation, ... struct employee* employees; ...
    (comp.lang.c)
  • Re: Proposed addition of malloc_size_np()
    ... for future realloc(), etc. ... are other uses such as for having a debug malloc wrap the real one, ... We can store that information, ... getting the size of each allocation, I don't know how much to subtract ...
    (freebsd-arch)
  • Re: Dynamic buffer library
    ... We do it this way instead of using a struct so that ... /* We now need to get the address of the buffer, because realloc() ... The address of the _pointer_. ... from and to all data pointer types, but void** canNOT validly point to ...
    (comp.lang.c)
  • Re: Array assignment via struct
    ... that what you're doing isn't guaranteed safe by the standard. ... Given that element a must be located at the start of struct S, ... > guarantee that A is suitably aligned for struct S? ... the allocation succeeds is suitably aligned so that it may be assigned to ...
    (comp.lang.c)