Could be inside a class for something to be sucked, making unsucked a variable for the class. CheckAndSuck would be a better name for the function. I don't think the meme needed a code audit but here I am.
However, if this was a functional programming language, there wouldn't be any mutable global variables to be unaware were being examined, nor could Suck do any sucking unless it were passed the thing to suck and returned the sucked thing.
In this way the subtle class of bugs that you both are warning against would be impossible to introduce.
Depending on the kind of sucking that Suck does, however, you may perceive the global invisibility and availability of the sucking as an advantage in this case. But possibly not if the code is your girlfriend/boyfriend.
No need to apologise for posting c++ in the channel. The programming world owes a lot to Prof. Stroustrup. I enjoyed your reply a great deal.
You have two choices: firstly, a regular regular attribute, where you can Suckable myThing; and myThing.CheckAndSuck; etc to your heart's content, and indeed no global variables are being sucked.
But you can also declare static bool unsucked; and what is a class variable if not a global variable by another name?
In fact, what is to stop your innocent-sounding accessor method from nuking the filesystem or calling memLeak.recurse();?
I'm not sure that these things keep you up at night, but you have my sympathy if they do.
If there was anything I could do to help you relax after a stressful day of multiple inheritance and manual memory management, I would.
Well, except that of course. I mean, we all draw the line somewhere.
Unless we've had too much to drink or smoked too much weed, in which case boundaries seem less important at the time.