efopen.c
Laura Creighton
laura at l5.uucp
Wed Oct 23 02:14:49 AEST 1985
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 at lll-crg.arpa
More information about the Comp.lang.c
mailing list