Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site l5.uucp Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!well!l5!laura From: laura@l5.uucp (Laura Creighton) Newsgroups: net.sources.bugs,net.lang.c,net.unix-wizards Subject: Re: efopen.c Message-ID: <210@l5.uucp> Date: Tue, 22-Oct-85 12:14:49 EDT Article-I.D.: l5.210 Posted: Tue Oct 22 12:14:49 1985 Date-Received: Thu, 24-Oct-85 06:18:48 EDT References: <1741@watdcsu.UUCP> <2109@brl-tgr.ARPA> <796@rlgvax.UUCP> <493@ttrdc.UUCP> Reply-To: laura@l5.UUCP (Laura Creighton) Distribution: net Organization: Nebula Consultants in San Francisco Lines: 54 Keywords: I'm writing a book Xref: linus net.sources.bugs:517 net.lang.c:6266 net.unix-wizards:12547 I've had it. I'm going to write a book, called *HOW TO WRITE PORTABLE C PROGRAMS*. I wonder if Prentice Hall will take it. It is not going to say anything that I don't think you should know already, but I am getting more and more convinced that there are only 50 people or so who know how to write good C code in the world. Please send me your favourite things that you wish people would know about C, so it can make it into the book. **WARNING** If it turns out that the problem is that you don't know C, I WILL TELL YOU THAT TOO. People who want to remain in ignorance about their decrepid coding practices should AVOID ME LIKE THE PLAGUE. Ahem. efopen is a great idea. I have one. This means that you can take your average piece of putrid slime and fix all the ``doesn't check if fopen succeeds'' bugs by globally changing all occurrances of fopen with efopen. The posted efopen does not pass lint. This sucks dead worms through a straw. What good is it to fix the sloppy and vile practices of the people who don't check fopen by adding more slime? The complaint that void is not well understood by compilers on micros is LOUSY. If your compiler does not understand void, then you can usually add a line to your makefile which reads: DEFINES= -Dvoid=int spiffo. add one line and your code works. *That's* portable. You don't have make? Well maybe you can type it in on a command line. You can't do that? Okay, hack either your source files, or (better) a header file that is included by all of them (if the program comes in modules -- you do write your programs in modules, don't you) to say: #define void int /* remove this line if your compiler knows about void */ which can probably go inside something appropriate like: #ifdef IBMPC mumblefrotz #endif What? You don't have a preprocessor? Hmm, I have my doubts as to whether you really have C. I'll bet you have lots of problems. I'll bet that globally changing all occurrances of void to int with your editor is the easiest job you get porting code. I'll bet you would pay real hard cash to only have to port code that passes lint and which checks the returns of its system calls, even if you had to use your editor to convert void into int every day. I'll bet you will buy lots of copies of my book... I am serious folks. Help beautify the world. Send me what you wish more C programmers did or stopped doing. -- Laura Creighton sun!l5!laura (that is ell-five, not fifteen) l5!laura@lll-crg.arpa