Summary: Realloc of function parameter problem.

Stanislaw L. Olejniczak SLORES at umiami.miami.edu
Tue Nov 28 01:19:14 AEST 1989


Many thanks for the numerous answers I received to my question.  The
problem was, of course, the requirement that realloc receives as an
argument either a pointer previously returned by a malloc _or_ (char *)0,
while I passed to it a pointer initialized as char *p = "A string".  Some
respondent warned me that some compiler implementations get confused if
the argument is (char *)0.

Knowing all this I went back to TFM, including some for beginners, some for
intermediate, and some for advanced users, and looked again for a clear
reference to that fact.  I was able to piece the reason from various
section of K&R, but simply _nowhere_ could I find documentation for
realloc stating that fact.  This includes basic and intermediate manuals,
which went to great lengths to explain dynamic memory allocation.  

If someone would have a suggestion on a book or two that would go into
such matters in a fairly clear manner, I woulod appreciate the
recommendations.  Again, thanks for all your help and assistance.

----
Stan Olejniczak               Internet:         slores at umiami.miami.edu
University of Miami, FL USA   UUCP: (temp void) gould!umbio!solejni
SLORES at UMIAMI.BITNET          UUCP: (?)         umigw!gables!slores
Voice: (305) 547-6571         FAX: (305) 548-4612  
My opinions cannot possibly represent the views of anyone else!



More information about the Comp.lang.c mailing list