Talk:c/language/scope
Contents |
[edit] Point of declaration, Notes
Should "12" be "32"? Should "baz_t" in comment be "baz"? Newatthis (talk) 06:03, 14 January 2015 (PST)
[edit] Block scope: // scope of the function parameter 'n' begins
If it's true that block scope terminates at the end of the associated block, then does the scope of the function parameter 'n' really begin again like the comment implies? Or, is the entity, parameter n, which is declared in the outer scope, just hidden (and not visible) within the inner scope and becomes visible again when the inner scope ends (6.2.1/4)? Is "begins" really the right word here? Newatthis (talk) 04:43, 15 January 2015 (PST)
[edit] Nested scopes
What is the thinking behind giving to "Nested scopes" the same level of significance as that given to the four scope names? Nested scope is not a fifth scope. It seems to be a form of block scope. Should the material of "Nested scopes" be folded into the sub-section "Block scope?" Newatthis (talk) 03:17, 16 January 2015 (PST)
- it is more significant than prototype or function scope. --Cubbi (talk) 03:27, 16 January 2015 (PST)
[edit] Function prototype scope
In the example,
void f ( // function name 'f' is at file scope long double f, // the identifier 'f' is now in scope, file-scope 'f' is hidden char (**a)[10 * sizeof f]) // 'f' refers to the first parameter, which is in scope { printf("%d\n", (int)sizeof **a); // prints 160 }
which identifier has a scope which "ends at the end of the nearest enclosing function declarator?" Function name 'f' has file scope. Both the long double identifier 'f' and the pointer 'a' are accessible from the function body (block scope). I think that a function declarator ends with the closing parenthesis. Newatthis (talk) 07:05, 26 January 2016 (PST)