Give me ONE reason to use a singleton instead of a global variable/structure.
Name:
Anonymous2006-06-19 6:10
- global variables may have namespace collision when their programs are used as modules
- global variables are placed right next to executable code in memory and open up buffer-overflow vulnerabilites
- global variables violate the principle of information hiding and encourage the programmer not to perform sanity checks as there isn't just "one way" in and out of the variable (i.e., through an access function)
- global variables use up RAM the entire time the program is running
- global variables are for noobs