Boost logo

Boost Users :

Subject: Re: [Boost-users] What does "RALL-style" means ?
From: Peter (peter_foelsche_at_[hidden])
Date: 2009-05-05 16:29:49


A lot of things can be partitioned into do-actions and undo-actions.
E.g. resource allocation and deallocation.

According to this philosophy you should perform do-actions in a constructor and the matching un-do action in a destructor.
Throw an object containing rich error information in case of the do-action fails.

The win32 library can be nicely wrapped into such classes.

When you're going this way you can chain such objects into base class and member class relationships.
You only have to write code for the successful case.
The compiler will generate code, to deal with the case any of the base or member object fails to initialize.
Try to allocate only a single resource in a single constructor.
Otherwise you will have to deal with failure by yourself instead of leaving this up to the compiler.

Another good philosophy (which may be derived from RAII) is to design classes in such a way,
that all public methods are always callable as soon as such an object exists.
Or in other words: It is bad philosophy to design classes in such a way, that certain methods must be called in a particular order.
Following this philosophy leads to code which avoids null-pointer access.
  "ZouLei" <zoulei.vresearch.org_at_[hidden]> wrote in message news:49fa7918.02578c0a.211a.ffffefc9_at_mx.google.com...
  Hi, everyone.

  When I refer the document of thread library, a word "RALL-style" appear in the introduction of the class lock_guard: This provides simple RAII-style locking of a Lockable object, to facilitate exception-safe locking and unlocking.

  I didn't got the main point of this word "RALL-style", could anyone tell me the meaning ? Thanks.

  Best wishes.

------------------------------------------------------------------------------

  _______________________________________________
  Boost-users mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net