"Pedro Izecksohn" <[EMAIL PROTECTED]> wrote:
> --- Ray Devore wrote:
[Ray's original context:
> > A global variable is defined outside of any function.
> > A static variable is declared with the keyword static.
]
> > You can have global static variables.
> 
> It is wrong.

Taken out of clear context, of course it's wrong. But since
Ray qualified exactly what he meant by global and static,
he's actually correct. Although, IMO his definitions have
the potential for creating misunderstandings.

> The scope of a static variable defined outside any function is
> only inside that source file.

All you're doing is substituting Ray's invented definition of
static for you own and then claiming Ray is wrong and you are
right.

> At least I'm not the only guy who writes wrong concepts some
> times. ;)

You're both wrong, or both right, depending on how you look
at it. ;-)

Unfortunately, the term 'global' is extremely common in
programming, but it's not a term defined in the C or C++
language definitions. It is used in describing certain
variables in many programming languages, but those
circumstances are not always precisely the same.

The term 'static' is slightly worse in that it is an
overloaded term. In C it can apply to both the linkage
and storage duration of objects. [C99 introduced yet a
third syntactical usage of static.] In C++, it's various
uses are even more convoluted!

What's important is to understand the concepts of identifier
scope, identifier linkage, and object duration. The term
static has different meanings in the different contexts.

So, if you want to answer the OP's question, then the OP
needs to define what _they_ mean by 'Global', and which
meaning of 'Static' they are asking about.

-- 
Peter

Reply via email to