Complexity of reallocating storage (was users command crap)

Marcus J. Ranum mjr at hussar.dco.dec.com
Fri Feb 8 03:54:37 AEST 1991


torek at ee.lbl.gov (Chris Torek) writes:
>many more programs now say
>
>	(void) fprintf(stderr,
>	    "foo: cannot open %s for reading: %s\n", file, strerror(errno));
>
>instead of
>
>	perror(file);
>
>(I find it rather appalling to see how much longer the `good' version is
>in a side by side, er, bottom by top, comparison like this.  Still, it
>seems worth it.)

	In the case of most of the code I've seen, I'm thrilled to death
to see perror() being used. Fortunately, code like:

	if((fd = open("foo",flags,mode)) < 0) {
		printf("can't open file, errno is %d\n",errno);
		exit(1);
	}

	seems to be on its way out.

mjr.



More information about the Comp.unix.programmer mailing list