POV-Ray : Newsgroups : povray.off-topic : GOTO : Re: GOTO Server Time
3 Sep 2024 23:30:12 EDT (-0400)
  Re: GOTO  
From: Warp
Date: 16 Oct 2010 15:58:01
Message: <4cba03c8@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   If you see something like this in C++:

> void foo()
> {
>     FILE* infile = std::fopen("file.txt", "r");

> then you should immediately see "DANGER! DANGER!", because whatever follows
> that will *not* be exception-safe (well, not unless the very next line is
> 'try').

  By the way, I honestly wonder what's the "proper" way of doing that
in Java, given that Java has exceptions and no scope-bound lifetime of
objects. Do you always have to follow file handle creation with a 'try'
block to guard against exceptions? Or is there some other trick to make
such code exception-safe?

  (I understand that in C# this is handled with a 'using' block, which
automatically and immediately disposes of objects when the block is
exited. Is that the proper way of making file handles exception-safe
there?)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.