aks,
@aks@scalie.zone avatar

Ok #cpp folks.

Is using static always evil or is having something like game state (paused, running, in menu etc) inside a static variable ok?

Or do i have to pass it around everywhere?

#programming

aeva,
@aeva@mastodon.gamedev.place avatar

@aks static variables are fine. if it wasn't good, bjarne wouldn't have put it in c++

gracicot,
@gracicot@mastodon.social avatar

@aks usually, you should use a static function scope variable to create a singleton. Then you do your stuff through it.

I usually avoid global mutable variables though, or singleton of any form.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • cpp
  • 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