473,729 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

visibility, declarative region, scope, validity, introduction and accessibility

All of the following terms are used in some way to describe where and how a
name is relevant to a particular location in a program: visible,
declarative region, scope, potential scope, valid, introduced, used,
potentially evaluated and accessible. They all seem to have subtle
difference in meanings.

Any positive contribution to the following will be appreciated.

Here is my attempt to make sense of these:

*)declarative region
The declarative region of a name is largest "containmen t" construct (block,
namespace or class) in which the name is valid. A declarative region which
is not global[1] is delimited by '{' and '}'. There may be more than one
such delimited construct composing a declarative region.

*)valid
Valid seems to mean "in scope", but I'm not sure if that is sufficient or
correct.

*)potential scope
The part of a program beginning immediately after the first point of
declaration of a name, and extending to the end of the name's declarative
region.

*)scope
The portion of the potential scope excluding any potential scope determined
by declaring the same name in an enclosed declarative region. [2]

*)introduced
A name is introduced into a declarative region by a declaration which makes
it valid[3] within that declarative region.

*)accessible
It's got to do with public, protected, private and friend, but I don't know
how best to put it into words.

*)visible
A name is visible if it is in scope and not hidden. A name may be visible,
and not accessible. I'm not sure of the consequences of that, however.

*)potentially evaluated
"An expression is potentially evaluated unless
**)it appears where an integral constant expression is required (see 5.19),
**)is the operand of the sizeof operator (5.3.3),
**)or is the operand of the typeid operator and the expression does not
designate an lvalue of polymorphic class type (5.2.8)."
*)used
"An expression is potentially evaluated unless it appears where an integral
constant expression is required (see 5.19), is the operand of the sizeof
operator (5.3.3), or is the operand of the typeid operator and the
expression does not designate an lvalue of polymorphic class type (5.2.8)."

[1]Is a translation unit a declarative region?

[2]The Standard says: "The scope of a declaration is the same as its
potential scope unless the potential scope contains another declaration of
the same name." I believe there is a subtle error in that statement. To
wit, a name may be redeclared in the same declarative region in which it
was originally declared, and the scope would not be affected.

[3]The definition is circular.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Dec 13 '06 #1
1 2581
Steven T. Hatton wrote:
All of the following terms are used in some way to describe where and how
a name is relevant to a particular location in a program: visible,
declarative region, scope, potential scope, valid, introduced, used,
potentially evaluated and accessible. They all seem to have subtle
difference in meanings.

Any positive contribution to the following will be appreciated.

Here is my attempt to make sense of these:

*)declarative region
The declarative region of a name is largest "containmen t" construct
(block,
namespace or class) in which the name is valid. A declarative region
which
is not global[1] is delimited by '{' and '}'. There may be more than one
such delimited construct composing a declarative region.

*)valid
Valid seems to mean "in scope", but I'm not sure if that is sufficient or
correct.

*)potential scope
The part of a program beginning immediately after the first point of
declaration of a name, and extending to the end of the name's declarative
region.

*)scope
The portion of the potential scope excluding any potential scope
determined by declaring the same name in an enclosed declarative region.
[2]

*)introduced
A name is introduced into a declarative region by a declaration which
makes it valid[3] within that declarative region.

*)accessible
It's got to do with public, protected, private and friend, but I don't
know how best to put it into words.

*)visible
A name is visible if it is in scope and not hidden. A name may be
visible,
and not accessible. I'm not sure of the consequences of that, however.

*)potentially evaluated
"An expression is potentially evaluated unless
**)it appears where an integral constant expression is required (see
5.19), **)is the operand of the sizeof operator (5.3.3),
**)or is the operand of the typeid operator and the expression does not
designate an lvalue of polymorphic class type (5.2.8)."
*)used
"An expression is potentially evaluated unless it appears where an
integral constant expression is required (see 5.19), is the operand of the
sizeof operator (5.3.3), or is the operand of the typeid operator and the
expression does not designate an lvalue of polymorphic class type
(5.2.8)."

[1]Is a translation unit a declarative region?
The following excerpt from the first example in §3.3.5 indicates to me that
the bounds of a translation unit do not delimit declarative regions. The
unnamed namespace is introduced in order to establish that delimitation.

namespace N {
int i;
int g(int a) { return a; }
int j();
void q();
}
namespace { int l=1; }
// the potential scope of l is from its point of declaration
// to the end of the translation unit

[2]The Standard says: "The scope of a declaration is the same as its
potential scope unless the potential scope contains another declaration of
the same name." I believe there is a subtle error in that statement. To
wit, a name may be redeclared in the same declarative region in which it
was originally declared, and the scope would not be affected.

[3]The definition is circular.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Dec 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2725
by: H | last post by:
Here is a good one!! A book I am reading on OOP states 'If any method is marked to allow overriding, the access can be changed by a derived class.' Also 'A derived class can even change a method's scope to public or private if
17
1909
by: abracad_1999 | last post by:
Easy Web Site Design web.twinisles.com is a short introduction to Web Design is aimed at the non-technical layman who wants to be able to place his/her message out there in cyberspace - quickly and easily. This site is designed specifically for the small businessman or perhaps the hobbyist who just wants to let more people know about what they do or think. Easy Web Site Design doesn't get bogged down in the finer points of coding or...
7
1466
by: Michael Sgier | last post by:
Hi folks class X { private: CTexture *modelTex; // texture data } CTexture* X::Load()
8
3375
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an actual program. To me "scope" of the name of a function or object are the general rules for the areas of a program that can through a declaration, have "visibility."
2
1918
by: Abdessamad Belangour | last post by:
Hi, I want to get the visiblity kind of a FieldInfo object. The "IsPublic" ans "IsPrivate" properties give the required information for public and private visibilities. My questions are: 1. What about "protected" visibility? 2. What exactly do we mean by Family ? Is it a hierarchy of deriving classes? 3. If a field is IsFamily, does it mean it's protected? 4. I tried to get some information through the example of msdn at :...
9
5336
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be (filtered) dependent upon the selection in DDL1. I think this inevitably needs some code, but I'd be happy to be told otherwise! I have some code to handle OnSelectedIndexChanged for DDL1 that sets the FilterExpression associated with the...
5
1764
by: Martin Wolff | last post by:
Hi !! To draw multiple graphics objects which have different shapes, I’m using the region class to exclude/union the drawing area of these Objects. The rectangle around a single object is of the size of 80x80 pixels. So looping through these pixels and excluding the area of every transparent pixel, the region will be built. Afterwards, such an object has a memory usage of approx. 700Kb (before
11
2633
by: -D- | last post by:
How can I turn the visibility of the xml control on or off? <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNavBar.ascx.cs" Inherits="compass.user_controls.TopNavBar" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <table cellSpacing="0" cellPadding="0" border="0"> <colgroup span="1" align="left" width="50%"> </colgroup> <colgroup span="1" align="right" width="50%"> </colgroup>
2
1856
by: Jamey Bon | last post by:
I am a C# newbie. I am having a tough time with several issues of scope and visibility. In short, why can't I see any of the elements of Form1 (the base form generated by the "Windows Application Project Wizard") from anywhere else in my project? For example, why can I not change the text of a TextBox control from Main() (which is, by default, in the Program class) even after I have set its visibility to public in Form1? Furthermore,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.