-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Darren New wrote:
> Christopher Smith wrote:
>> It sure is a lot uglier than the C++ equivalent, 
> 
> And it's not as reliable, either, for that matter. If the finalization
> throws, for example, you can wind up with problems.

Yes, the complete idiom includes trapping the finalize() with an empty
catch (Throwable). Of course you have similar problems on C++'s side
with destructors that throw exceptions.

>> C# is mildly better with it's "using" keyword, which is essentially a
>> more generalized version of Java does with synchronization primitives.
> 
> And also not reliable if the constructor throws..

Huh?

using (Foo foo = new Foo(...))
{
  ...
}

What's not reliable there? Either foo gets initialized or it doesn't. If
it does, then finalize() is reliably called. If it doesn't, then
finalize() is reliably *not* called. Either way, entirely reliable.

- --Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGbeX9OagjPOywMBARAtpBAJ9QucWvsyeYVDgKx/VRCldi0wUEGACgneIs
OGfKceM1a3Rw9UxTrB/+EHs=
=C5VK
-----END PGP SIGNATURE-----

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to