Difference with "static" and "new"
#7

About the size -- it isn't important at all. The static keyword serves other purposes. newbienoob already mentioned one usage: keeping the variable inside its file. Keeping a variable known in only a function's scope is beneficial when working on large or confusing code, it leaves you less room for error.
Its function is that its value is kept. It is not stored on the stack and very speaking by a simplified model of memory management, it is as fast as any other global variable (which are in the data segment of some sort, on the heap).

But please do find the keyword useful.
Reply


Messages In This Thread
Difference with "static" and "new" - by Luis- - 05.03.2014, 16:38
Re: Difference with "static" and "new" - by Konstantinos - 05.03.2014, 16:53
Re: Difference with "static" and "new" - by Kyle - 05.03.2014, 16:57
Re: Difference with "static" and "new" - by newbienoob - 05.03.2014, 17:00
Re: Difference with "static" and "new" - by Luis- - 05.03.2014, 17:18
Re: Difference with "static" and "new" - by Konstantinos - 05.03.2014, 17:23
Re: Difference with "static" and "new" - by AndreT - 05.03.2014, 17:32
Re: Difference with "static" and "new" - by Djole1337 - 05.03.2014, 17:44

Forum Jump:


Users browsing this thread: 2 Guest(s)