Get the latest tech news

I Like and Use Global Variables


w saying global variables will make some of you twitch. If that's you go to your happy place, otherwise strap yourself in.

MyStruct constructor uses a static int which lives outside the stack and retains its value across multiple calls. Having dozens of files use their own set of global variables to tweak behavior will quickly cause state to go out of sync and create a high amount of bugs. They can't clear the workList or modify nodes on it ✅ Original work list is restored.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of global variables

global variables

Related news:

News photo

Global variables are not the problem