On Tue, 4 Mar 2003, Scott R. Godin wrote:

> George P. wrote:
> 
> > I noticed that you've said
> > "open () or die()"
> > and
> > "close() or die()"
> > 
> > If open fails, the program will kill itself, so the close function
> > will never be called.
> > Therefore there is no need to say "close() or die()"
> 
> not true.
> 
> > You've done it thrice in this email, so I'm presuming
> > that it's a habitual thing.
> > 
> > Putting it won't hurt, but it's not useful either.
> > 
> > Just thought I should point it out :)
> 
> 
> The simple answer is: Good programming practice.

You are right it is "Good Programming practice" to be defensive. Even though 
I would advocate a "close () or warn ()" instead of a "close () or die ()". 

But then again the choice is subjective, but "defensive programming" holds
always.

> 
> What if something happens to the file before I'm able to close the 
> filehandle? 
> 
> This has implications beyond the simple example shown here, and consequently 
> I've made it a force of habit to always check success of certain operations 
> as a matter of course. 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to