Re: Thank You -- Thomas J. Gritzan



Tom said:

<snip>

Now I am using malloc(), realloc() and free(). I am casting the
pointer output of malloc() and realloc() to match my data structure.

Why?

(The need for this casting is poorly described in the realloc() doco
in my opinion.)

There is no such need. The cast is unnecessary and obfuscatory, and can
conceivably conceal the bug of failing to provide a prototype for *alloc,
which happens from time to time.

<snip>

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.



Relevant Pages

  • Re: C perfomance
    ... snip ... ... >> b) I find that realloc() calls sometimes take more time to ... >> complete than malloc() calls. ... Spraying declarations around through the body of ...
    (comp.lang.c)
  • Re: vasam
    ... Here is the sequel of my previous post "Variable array sizes as members" ... I was given some advice on how to use malloc and realloc in oder to achieve ...
    (microsoft.public.vc.language)
  • Re: Why does this segfault?
    ... > apparently, freewas placing data of some ... > had allocated with realloc(). ... The first time through the main loop in ... the heap (where malloc() and reallocget their memory). ...
    (comp.unix.programmer)
  • Re: Problem with realloc (I think)
    ... compiler has a problem with realloc. ... the compiler I'm using is Borland C++ 5.x ... needed multiple realloc calls uses the Windows API memory routines. ... If changing your malloc implementation makes your code work, ...
    (comp.lang.c)
  • Re: malloc/free question
    ... I'd like to be able to malloc a block of memory, ... For example, malloc 100 ... Use realloc. ... guaranteed that a reallocrequesting a smaller size will succeed; ...
    (comp.lang.c)