Re: opening a file
- From: cartercc <cartercc@xxxxxxxxx>
- Date: Wed, 14 Jan 2009 07:27:12 -0800 (PST)
On Jan 14, 9:30 am, Chris Mattern <sys...@xxxxxxxxxxxxxx> wrote:
If you don't care whether the file opens, why are you opening it?
My point was that you can conjure up an exception for every rule.
In my job, I constantly write and run scripts that open and close
files. Many of these scripts are on-the-fly scripts. I've been at work
for three hours today, and already I've written two of these kinds of
scripts and have run around two dozen. Very rarely do I bother
checking the return value of open(), and I don't ever recall having an
open fail. The biggest problem I have is with typographical errors,
and warnings catch those.
I totally agree with error checking, and the scripts that I write for
others to run ALWAYS include this kind of error checking. The scripts
that I write FOR MYSELF for processing files rarely do, however,
because open() never fails and I'm too lazy to take the extra effort
(small though it may be) to type out the 'or die' clause. My quibble
is not with the rule, but with the idea that the rule has no
exceptions. Every rule has exceptions.
If it's any consolation, I am the only one that suffers the penalty
for not checking whether or not a file opens in my own scripts, and I
am perfectly willing to risk incurring the penalty to keep from typing
a few extra keystrokes with every invocation of open. This is a
deliberate choice on my part, and I have never sought to impose that
choice on anyone else.
CC
.
- Follow-Ups:
- Re: opening a file
- From: Peter J. Holzer
- Re: opening a file
- From: Hans Mulder
- Re: opening a file
- From: Tim Greer
- Re: opening a file
- References:
- opening a file
- From: George
- Re: opening a file
- From: cartercc
- Re: opening a file
- From: Jürgen Exner
- Re: opening a file
- From: George
- Re: opening a file
- From: Tad J McClellan
- Re: opening a file
- From: cartercc
- Re: opening a file
- From: Chris Mattern
- opening a file
- Prev by Date: Re: Add columns of a File
- Next by Date: Re: Add columns of a File
- Previous by thread: Re: opening a file
- Next by thread: Re: opening a file
- Index(es):
Relevant Pages
|