[SDL] static declaration (WAS: SDL-ttf (PATCH))

Clemens Kirchgatterer clemens at thf.ath.cx
Tue Sep 3 23:28:00 PDT 2002


Loren Osborn <linux_dr at yahoo.com> wrote:

> On Tue, 2002-09-03 at 13:29, Nick Whitelegg wrote:
> > Thanks for the feedback on this. I have to admit, global variables
> > and the ins and outs of them were never my strong point, I never
> > knew that by making a global variable "static" it became private!
> 
> In C anyway, yes... It's not private, per-se, but sybol-less... 
> Without a symbol, no code in any other object file can access it. 
> This is what static used to mean.  In C++ static now has several
> meanings, depending on context.  With globabl variables, static has
> the same meaning it did in C... 

[...]

>  In a
> function it refers to a local variable that only gets initialized once
> (when the function first executes), and doesn't get destroyed until
> the program exits...

this is also true for C not only for C++.

JFYI ...
clemens




More information about the SDL mailing list