K
Keith Thompson
BartC said:Eric Sosman said:BartC said:[...]
(I think it depends on whether you mean lexical or dynamic scope.)
The phrases "lexical scope" and "dynamic scope" appear
nowhere in the Standard.
The behaviour being discussed is not unique to C, so it seemed
acceptable to use more informal terms, especially as we aren't in
comp.std.c.
Even informally, the word "scope" refers to visibility. Some
languages have dynamic scope; C does not. The relevant distinction
here is between scope and lifetime, not between different kinds of
scope.
I'm guessing most people reading this group aren't intimately
acquainted with Concepts VI:2:1.
That would be C99 6.2.1 (yes, I know you're making a joke about
"chapter and verse"). But I'd say that's all the more reason to use
correct and consistent terminology. Those of us are familiar with
6.2.1 know what "scope" means in C.
I've just realised I'm working on a language where it is possible to
access main.a (and so on) from anywhere else. Now I have to work out
(1) how to implement it and (2) what it actually means (bearing in
mind there might be multiple main.a's in existence).
<OT>And for functions other than main, you need to work out what to do
if there are *no* func.a's in existence. Providing visibility to a
function's local variables from outside that function doesn't seem
like a particularly good idea, but perhaps it makes sense in
context.</OT>