Path: csiph.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail From: Melzzzzz Newsgroups: comp.lang.c Subject: Re: High level C Date: Sat, 6 Aug 2016 02:23:32 +0200 Organization: albasani.net Lines: 43 Message-ID: <20160806022332.39b341ad@maxa-pc> References: <87mvlimt9i.fsf@bsb.me.uk> <5793c3cb.1636046@news.xs4all.nl> <65b61a13-a54c-4ade-9168-4d71de86103f@googlegroups.com> <89cbb9bc-51c5-45f0-b0ba-c0d469a0b668@googlegroups.com> <20160731164221.2f1d338d@maxa-pc> <20160805054817.0af37f27@maxa-pc> <20160806005008.3218a22e@maxa-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.albasani.net ZWeWrcHj1F7vNQgONcyFj+8Mz6VpIJfLD46rh1uZgd2QRdj8AfXR1YZ5+00nIk5VJz/WbbZNEqRZ6riSPvVnUg== NNTP-Posting-Date: Sat, 6 Aug 2016 00:23:32 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="qzd7YTn72KatpQD3Yafw3qB4h1apL1nYAe8m/nop/QFhrX4oUFZuIq14wg345BfbjSd+/vvnUNoMh6flNZqBrSboOT0I6vaQzXZPQntqb6TnVLe6n4NQqL6+j7XBI0BJ"; mail-complaints-to="abuse@albasani.net" X-Newsreader: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-unknown-linux-gnu) Cancel-Lock: sha1:4FpWKnkLAa3VBsQTozoFmgtXMBE= Xref: csiph.com comp.lang.c:91793 On Fri, 05 Aug 2016 17:08:59 -0700 Keith Thompson wrote: > Melzzzzz writes: > > On Fri, 05 Aug 2016 15:39:29 -0700 > > Tim Rentsch wrote: =20 > >> Melzzzzz writes: =20 > [...] > >> > Wrong. Finalizers are useless for resource management as > >> > conservative GC is non deterministic. Finalizers are only good > >> > for debugging purposes... =20 > >>=20 > >> That is a gross overstatement. =20 > > > > That overstatement is not mine. I heard it lot of times... =20 > [...] >=20 > It's a statement you made without attribution or qualification. >=20 I think it's well known fact. I believe it's all over the internet... eg " This dual interface leads to another inevitable borrowing from C# (ultimately, a Java feature): finalizers. A finalizer is a block of code that is executed when the GC reclaims the storage of an object allocated by gcnew. In the early 1990s, finalizers were considered the Java equivalent of destructors but programmers soon realized that they weren=E2=80=99t. Determinacy is the main difference between the two. A C++ destructor always executes at a predictable time -- when calling delete, when an automatic object goes out of scope etc. By contrast, a finalizer is executed at an unpredictable time after the object has become unreferenced. This could take seconds -- or weeks. When the GC is suspended or completely disabled, finalizers don=E2=80=99t run. This err= atic behavior makes finalizers nearly useless. The easiest way to see it is by comparing a corpus of C++ code with a Java/C# corpus of the same size. The C++ destructor count compared to the number of finalizers is revealing. A ratio is about 1 finalizer for every 100 destructors shouldn=E2=80=99t come as a surprise. " https://www.informit.com/guides/content.aspx?g=3Dcplusplus&seqNum=3D274