From: "Matthew Conte" Newsgroups: comp.os.msdos.djgpp Subject: Re: 64k demo (slightly off-topic reply) Date: Sun, 14 Jun 1998 02:13:59 -0400 Organization: ICGNetcom Lines: 26 Message-ID: <6lvpq2$4e@sjx-ixn4.ix.netcom.com> References: <35819A38 DOT C1BA3FCB AT hotmail DOT com> <358305BC DOT 61AB AT stud DOT warande DOT ruu DOT nl> <6lun9s$cie AT dfw-ixnews10 DOT ix DOT netcom DOT com> <35833ED8 DOT 9EB75F08 AT cartsys DOT com> NNTP-Posting-Host: frm-ma1-11.ix.netcom.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Nate Eldredge wrote in message <35833ED8 DOT 9EB75F08 AT cartsys DOT com>... >> Quick question: is access to a dynamically allocated array slower than a >> static global array, or are they the same? > >They're the same. Memory is memory. Of course, if it gets swapped out, >it will be slower, but that can apply in either case. Here was my logic: static variables/arrays can only be accessed by the source file that they are declared in, so I figured that they would be closer to the functions they were used in on the stack. A global variable/array can be accessed by any source file/function that uses it, so accesses to it are further along on the stack, and this access takes longer. So in my application (a NES emulator) any array or variable that needs to be shared between functions, I try to declare as static so that it can be accessed by the functions in that source file, but not functions from other linked object files. Is there a flaw in my logic? All replies (posts) are appreciated, as I've never found conclusive answers to this topic. Thanks, Matt.