When words are good and when words

preece at ccvaxa.UUCP preece at ccvaxa.UUCP
Tue Aug 6 01:26:00 AEST 1985


> In article <2600006 at ccvaxa> preece at ccvaxa.UUCP writes:
> > Unfortunately, the name 'opentest' doesn't imply that the variable
> > named 'foo' has been set to the new fd and that the file is now open.
> > It implies (to me, at least) a test of whether it is possible to
> > open the file.  Now, if you wanted to call it "TRY_TO_OPEN", I would
> > be more likely to interpret the name correctly, but some people might
> > interpret that name as a Boolean indicating whether or not to try to
> > open the file.  Naming is very tricky.  Doing the operation is very
> > clear.
> 
> On the other hand we have somebody saying that a particular word isn't
> clear enough (opentest) and offering up another (TRY_TO_OPEN) saying
> that his is unambiguous.  (I don't quite follow him though, since 
> all EITHER open() or fopen() do is TRY_TO_OPEN a file, returning
> an indicator as to their success, that the indicator is also useful
> in later code isn't important).
----------
What I was TRYING to say was that NEITHER name was very good and that
I thought you should let C look like C and use the 
"if ( (x=fopen(...)) == NULL) {...}" form.  Words are too likely to
mean one thing to me and another to you.  Don't use a macro or
procedure unless it's a useful, clear abstraction of what is being
done.

-- 
scott preece
gould/csd - urbana
ihnp4!uiucdcs!ccvaxa!preece



More information about the Comp.lang.c mailing list