realloc reactions ??

Steve Lamont slamont at network.ucsd.edu
Sat Feb 16 06:09:56 AEST 1991


In article <9102150952.AA24219 at karron.med.nyu.edu> karron at cmcl2.nyu.edu writes:
>
>I am curious about the realloc function. 

Me too, but for a different reason than Dan.  Why does SGI's realloc() barf on
a null pointer.  F'rinstance

#include <stdio.h>
#if defined( mips )
#include <malloc.h>
#else if defined( __STDC__ )
#include <stdlib.h>
#else
char *realloc();
#endif

main()

{

    char *foo = ( char *) NULL;

    foo = ( char *) realloc( foo, 100 );

    printf( "I allocated foo at %08lx\n", foo );
    exit( 0 );

}

provides me with

	Bus error (core dumped)

in small, unfriendly letters on an SGI.  On all other platforms it gives me a
valid pointer.  Bug, feature, misfeature, or hallucination?

							spl (the p stands for
							plethora of pointers)
-- 
Steve Lamont, SciViGuy -- (408) 646-2572 -- a guest at network.ucsd.edu --
NPS Confuser Center / Code 51 / Naval Postgraduate School / Monterey, CA 93943
"Unix is not a "A-ha" experience, it is more of a "holy-shit" experience."
				- Colin McFadyen in alt.folklore.computers



More information about the Comp.sys.sgi mailing list