Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!decwrl!pa.dec.com!decuac!hussar.dco.dec.com!mjr From: mjr@hussar.dco.dec.com (Marcus J. Ranum) Newsgroups: comp.unix.programmer Subject: Re: Complexity of reallocating storage (was users command crap) Message-ID: <1991Feb07.165437.1289@decuac.dec.com> Date: 7 Feb 91 16:54:37 GMT References: <8921@sail.LABS.TEK.COM> <1991Feb07.013637.6542@convex.com> <9646@dog.ee.lbl.gov> Organization: Digital Equipment Corp., Washington Ultrix Resource Center Lines: 25 torek@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.