beeoproblem,
@beeoproblem@mastodon.gamedev.place avatar

A post about C++ got me thinking about how I've not really seen anything quite as clean (in theory at least) as RAII.

In short:
create an object to get a resource (e.g. open a file)
delete it to release (e.g. close the file)

Multiple languages have a "using" or "with" block that works similarly but they usually require some extra work to use and can be skipped. If you design your class right RAII requires no special code in the client.

Resources automatically release as they fall out of scope

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines