Top "Global-variables" questions

Global variables are variables that are accessible from all elements of a software component.

When are static and global variables initialized?

In C++ I know static and global objects are constructed before the main function. But as you know, in C, …

c++ static initialization global-variables
What is the correct way to check if a global variable exists?

JSLint is not passing this as a valid code: /* global someVar: false */ if (typeof someVar === "undefined") { var someVar = "hi!"; } What …

javascript global-variables jslint
PHP variables in anonymous functions

I was playing around with anonymous functions in PHP and realized that they don't seem to reach variables outside of …

php function variables global-variables anonymous
Should I use window.variable or var?

We have a lot of setup JS code that defines panels, buttons, etc that will be used in many other …

javascript global-variables
PHP session side-effect warning with global variables as a source of data

I'm trying to host a PHP web site that was given to me. I see this warning: Warning: Unknown: Your …

php session global-variables session-variables
When is it ok to use a global variable in C?

Apparently there's a lot of variety in opinions out there, ranging from, "Never! Always encapsulate (even if it's with a …

c global-variables
How to tell JSLint / JSHint what global variables are already defined

In my project we have some global variables that work as containers: MyProject.MyFreature.someFunction = function() { ... } So then I use …

javascript global-variables jslint jshint
Why a variable defined global is undefined?

I have here a simple function and a global variable. Why is myname undefined and not the string "global"? var …

javascript global-variables local-variables hoisting
class variables is shared across all instances in python?

I started coding in python a week ago, it is my mistake i started coding using oops,classes and objects …

python class global-variables instance-variables member
Does C++ call destructors for global and class static variables?

From my example program, it looks like it does call the destructors in both the cases. At what point does …

c++ global-variables destructor