answersLogoWhite

0

Global variables are accessible to any code making it much more difficult to determine when and where a global is being modified. They can also lead to data-races whenever two threads try to write to the same global at the same time, or one tries to read the global while another is modifying it. The more complex the global the greater the risk.

Globals are not necessarily bad provided they are thread-safe and genuinely represent a truly global concept. If not, use a local variable instead.

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How do you avoid bugs in VB 6.0?

There is no simple answer to that. It is very difficult to avoid bugs in programming. If you can write perfect code, then you won't get any bugs. However, even very experienced programmers make mistakes in their code which result in bugs. In a small and simple program, it is not difficult to avoid bugs, but if you are writing a complex system, it is much more difficult. Following good design and planning of your system will reduce the amounts of bugs you will get.


Why is it important to initialize your variables?

Initializing variables is crucial because it ensures that they have a defined value before use, preventing unpredictable behavior and errors in your code. Uninitialized variables can lead to bugs that are difficult to trace, as they may contain garbage values. Proper initialization also improves code readability and maintainability, making it clear to other developers (or your future self) what values the variables are intended to hold. Overall, it promotes safer and more reliable programming practices.


Is bed bugs like craps?

Yes, they are very similar in their behavious, once you have bed bugs, they are also difficult to get rid of.


How many fans does Bugs Bunny have?

Bugs Bunny is known world wide and it would by difficult to quantify exactly how many fans he has .


Why do bugs hate smoke?

Bugs hate smoke because it can irritate their sensitive respiratory systems, making it difficult for them to breathe and survive.


What are the three variables for milkweed-bug hatching experiments?

The three variables for milkweed-bug hatching experiments are typically temperature, humidity, and light exposure. These variables can affect the rate of hatching, development, and overall survival of milkweed bugs.


Do bed bugs bite dogs?

It is possible, but uncommon, as bed bugs do not like fur. It makes it very difficult for them to move around, as they do not have "sticky pads" on their feet.


Do green bed bugs exist and how can they be identified and treated?

Green bed bugs do not exist. Bed bugs are typically reddish-brown in color. They can be identified by their small size, oval shape, and flat bodies. Treatment for bed bugs usually involves professional pest control services, as they are difficult to eradicate on your own.


Is it the programmers responsibility to initialize all variables that must start with a specific value?

Yes, it is the programmer's responsibility to initialize all variables that must start with a specific value. Proper initialization ensures that the variables hold valid data before they are used, preventing undefined behavior and potential bugs in the code. Additionally, initializing variables contributes to code readability and maintainability, making it clear to others what the intended starting values are.


What were the geographical conditions that made building the Panama canal difficult?

The landscape was very difficult by means of digging. Another big issue was the bugs (mosquitoes) were everywhere and all over workers.


What are Bugs Bunny personality traits?

He's an in-your-face smart-alec with a sharp tongue and a penchant for making things difficult for others.


What are some examples of bugs that look like sand?

Some examples of bugs that look like sand include sand fleas, sand flies, and sand beetles. These insects have evolved to blend in with their sandy environments, making them difficult to spot.