Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #15324

Re: Terminology - RAII vs. Scope Guard vs...?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date Thu, 12 Apr 2012 12:18:12 -0500
From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Terminology - RAII vs. Scope Guard vs...?
References <2b96be9d-1925-4455-b6f9-12b2b15ebfad@x17g2000yqj.googlegroups.com> <2afef88f-f05f-4eb7-929b-fb587f674c68@er9g2000vbb.googlegroups.com> <9164b5b9-0424-4acf-9d2f-1344db90b3a7@w5g2000vbv.googlegroups.com> <d94ae8b7-7785-4464-8c6d-0d7b0a3c7494@h20g2000yqd.googlegroups.com> <slrnjobubm.1ls.grahn+nntp@frailea.sa.invalid> <c458dacc-4d41-4b71-8de0-0e66d1b59d77@12g2000vba.googlegroups.com> <4f8671dd$0$3116$7b1e8fa0@news.nbl.fi>
Date Thu, 12 Apr 2012 18:18:11 +0100
Message-ID <87ehrszx64.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:1sEnCU8q6NJJDwhjWz4MOSD2uRc=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 26
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-RutmeDybnSTdSE+u1DX07cWTnnxc3K9p57mgQV3xuPvTGg/D36i7rGO0xL7Qcds1yhyKAdB+Ss6gn4u!sOiSPvpeKX8ZS/hZ4vDG3rAwgiUbBDY3H1fERD1ed6+vNWoB4fK1HDcG5DIPhx9w0PU=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2578
Xref csiph.com comp.lang.c++:15324

Show key headers only | View raw


Juha Nieminen <nospam@thanks.invalid> writes:

>   The wikipedia page also seems to assume that RAII is just about scope-based
> construction and destruction of objects, as indicated for example by giving
> the gcc extension "cleanup" variable attribute as an example on how to
> emulate RAII in C. However, it's not just about construction and destruction
> of objects. One extremely important part of RAII is copying (both in the
> form of copy constructors and assignment operators).

I don't think that's an unreasonable distinction. Clearly, copying
semantics have to be well defined for any RAII-like
resource-management-through-ownership idiom/scheme/philosophy to work,
but you don't need C++ copy/assignment.

You could define 

* a language that forces copyable object to have a java-like
  user-provided clone() for all objects, and no implicit copying or
  assignment for user defined types (just as many C++ polymorphic
  classes do)
* or a language where every object acted like std::shared_ptr 
* or even (god forbid) a language where every object acted like
  std::auto_ptr

and still have RAII, just as long as you had destruction when the last
reference vanished.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-10 13:47 -0700
  Re: Terminology - RAII vs. Scope Guard vs...? Joshua Maurice <joshuamaurice@gmail.com> - 2012-04-10 14:36 -0700
    Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 09:10 -0700
      Re: Terminology - RAII vs. Scope Guard vs...? Joshua Maurice <joshuamaurice@gmail.com> - 2012-04-11 12:28 -0700
        Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 13:29 -0700
          Re: Terminology - RAII vs. Scope Guard vs...? Rui Maciel <rui.maciel@gmail.com> - 2012-04-12 02:29 +0100
          Re: Terminology - RAII vs. Scope Guard vs...? Joshua Maurice <joshuamaurice@gmail.com> - 2012-04-12 14:31 -0700
            Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-12 16:48 -0700
              Re: Terminology - RAII vs. Scope Guard vs...? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-04-13 02:34 +0200
                Re: Terminology - RAII vs. Scope Guard vs...? Miles Bader <miles@gnu.org> - 2012-04-13 10:57 +0900
                Re: Terminology - RAII vs. Scope Guard vs...? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-04-13 09:52 +0200
                Re: Terminology - RAII vs. Scope Guard vs...? Rui Maciel <rui.maciel@gmail.com> - 2012-04-13 10:48 +0100
                Re: Terminology - RAII vs. Scope Guard vs...? Miles Bader <miles@gnu.org> - 2012-04-13 22:18 +0900
                Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-13 09:21 -0700
        Re: Terminology - RAII vs. Scope Guard vs...? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-11 21:36 +0000
          Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 16:07 -0700
            Re: Terminology - RAII vs. Scope Guard vs...? Juha Nieminen <nospam@thanks.invalid> - 2012-04-12 06:10 +0000
              Re: Terminology - RAII vs. Scope Guard vs...? Gareth Owen <gwowen@gmail.com> - 2012-04-12 18:18 +0100
                Re: Terminology - RAII vs. Scope Guard vs...? Juha Nieminen <nospam@thanks.invalid> - 2012-04-13 04:52 +0000
                Re: Terminology - RAII vs. Scope Guard vs...? Gareth Owen <gwowen@gmail.com> - 2012-04-13 06:59 +0100
                Never using free() or realloc().  Destroying heaps.  @Jeff-Relf.Me - 2012-04-13 00:55 -0700
      Re: Terminology - RAII vs. Scope Guard vs...? Rui Maciel <rui.maciel@gmail.com> - 2012-04-11 21:28 +0100
        Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 13:40 -0700
          Re: Terminology - RAII vs. Scope Guard vs...? Rui Maciel <rui.maciel@gmail.com> - 2012-04-12 02:27 +0100
            Re: Terminology - RAII vs. Scope Guard vs...? scott@slp53.sl.home (Scott Lurndal) - 2012-04-12 17:25 +0000
              Re: Terminology - RAII vs. Scope Guard vs...? Gareth Owen <gwowen@gmail.com> - 2012-04-12 19:21 +0100
            Re: Terminology - RAII vs. Scope Guard vs...? Noah Roberts <roberts.noah@gmail.com> - 2012-04-12 16:38 -0700
              Re: Terminology - RAII vs. Scope Guard vs...? Rui Maciel <rui.maciel@gmail.com> - 2012-04-13 11:02 +0100
          Re: Terminology - RAII vs. Scope Guard vs...? nick_keighley_nospam@hotmail.com - 2012-04-13 00:29 -0700
      Re: Terminology - RAII vs. Scope Guard vs...? nick_keighley_nospam@hotmail.com - 2012-04-13 00:14 -0700

csiph-web