General Discussions

The POWER of Static – luke

luke

Member

Posts: 311
From: I use your computer as my second Linux box
Registered: 10-30-2005
Ok, Ive used static for a long time and Im not new to it or anything. Just thought some of you guys who are new to static (its in Cpp as well as JAVA) might like to see some of static's power:
I made a program W/O static and each object of destroyer had a 1k image*32(for rotations) I could have a max WORKING ammount of about 10 .
btw it took up 79megs of system mem
Enter static.
I made a programe W/Static and each type of ship had a 1k image*32
I only had a destroyer with some very small ammount of code. The otherwise same program had a WORKING max of 1000 destroyers ))
btw it took up 18megs of system mem.

------------------
Omnia Vos Estis Cordatis

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
what's static?

(and yes, i googled it.)

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!

luke

Member

Posts: 311
From: I use your computer as my second Linux box
Registered: 10-30-2005
the 'qualifyer' static makes the int, object, float, double, char or anything that you can put a qualifyer infront of; global for that class. In other words in the example above, w/o static means that EACH OBJECT of the destroyer class would have 32images, and with Static, each object would share 32images with all other objects of the destroyer class, see what I mean?

------------------
Omnia Vos Estis Cordatis

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
sort of... lol..

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!