|
Hello,
I have a question regarding gcc. Why I get an error of unused variable when I define the variable locally in a function but not when the variable is global in a unique file?.
I can understand that it can be use for someone else, but to do that ...
Started by Eduardo on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Because if it's global....
Because global variables canThe compiler has no way of knowing if a global variable is used - it could be used.
From a compilation unit written in a completely different language, for example .
|
|
Hi all
I'm creating a 2d tile based sim game. I have a 2d array of gridSquares, which are accessed and changed from many different classes and methods. Should I pass the 2d array of gridSquares each time, or make it a global? Which is best practice?
I...
Started by Relequestual on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Pass them in constructors and hold them in member variables.
There are arguements for and against this though create a second instance of a singleton) .
The singleton pattern, essentailly making it global.
|
|
Why there are no global variables in java? If I like to use any variable in all classes of a program then how can I do that?
Answer Snippets (Read the full thread at stackoverflow):
Some valid global "variables" are constants ;-) for example: Math.PI
Global variables do not jive....
Global variables (in the Java context - public static variables) are bad, because it.
Design Pattern.
|
Ask your Facebook Friends
|
Is there a way to make all variables global?
Started by tarnfeld on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Ok :) I was using from the class loaded before hand... .
But in short, there is no simple way to do it without a lot of global statements.
Better off just passing variables as arguments to functions or by declaring them global there.
|
|
How do I declare global variables in Visual C#?
Started by Phenom on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Declare global variables - use static class or Singleton pattern
The nearest you can do this in C# = 42; }
However, you should try to avoid using global variables as much as possible and look at why you think you need a ....
|
|
According to many sources, register_globals (global variables that is) should be disables in your php.ini. Should I write define() in my code and use constants if global variables are disabled? Are those even related?
Started by Gal on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
In general programming terms, global variables (not....
In that they have global scope, but constants are meant to not change once defined, unlike global variables which global variables in your application.
|
|
Possible Duplicate:
Is global variable in a shared library / dll, shared across process
Hi stackoverflow, I have just a little question about using .so in C programming. I want to use static and global variables in a shared library. If this library is...
Started by lioks on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
No, global variables are global inside.
Will these processes share the global variables
No.
|
|
I want some variables to be global across the the project and accessible in every form. How can I do this?
Started by Moon . on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Like this:
static class Global { private static string.
Yes you can by using static class.
|
|
What is the best way to use global variables in Javascript?
Should I do document.x="this" , document.y="that" ?
How will I avoid collisions in the long run?
Started by flybywire on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
You can write Object Oriented JS and keep your variables in one name space, more or less that namespace
myns.foo = 50;
In this sense, the only....
You don't need to attach Practice.
Anything declared outside a function, is, by default, global.
|
|
Does PHP have global variables that can be modified by one running script and read by another?
Started by Jeremy Rudd on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Global variables in php common substitution....
Each request is handled by a php instance of its own .
Global variables simply mean that they can be accessed in the script regardless the variables.
By the next PHP script.
|