Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Constant global variables in C++

Tom,
CDT has no convenient support for determining the linkage of a name.
 
For the purpose of tooling we cannot directly use the notion of internal linkage. For example
when searching for the references of a global constant, one will expect to see all references
regardless of in which compilation unit they reside. However, when searching for references
of a (non-constant) global variable you expect to see the references of one compilation unit,
only. Therefore we have introduced IIndexBinding.isFileLocal() to deal with this tooling specific
distinction.
 
Markus.

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Tom Longridge
Sent: Thursday, February 11, 2010 10:21 AM
To: 'CDT General developers list.'
Subject: RE: [cdt-dev] Constant global variables in C++
Importance: Low

Thanks Markus, that’s what we had suspected.

 

In that case, is there any way of determining whether a variable has internal or external linkage?

 

Tom

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Schorn, Markus
Sent: 11 February 2010 08:57
To: CDT General developers list.
Subject: RE: [cdt-dev] Constant global variables in C++

 

Hi Tom,

The c++-standard defines the static 'storage-class-specifiers' as a piece of grammar (7.1.1). IVariable.isStatic() tells you whether a static storage-class-specifier has been used for the declaration of the variable.

 

What Microsoft refers to is defined as internal vs. external linkage of a name. And indeed constant global variables

have internal linkage (7.1.6.1).

 

Note, that there is also a notion of static storage duration (3.7), which is something different.

 

Markus. 

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Tom Longridge
Sent: Wednesday, February 10, 2010 5:49 PM
To: 'cdt-dev@xxxxxxxxxxx'
Subject: [cdt-dev] Constant global variables in C++
Importance: Low

Hi all,

 

Is it correct to say that constant global variables in C++ have static storage class? (This is suggested here: http://msdn.microsoft.com/en-us/library/0d45ty2d(VS.80).aspx.)

 

If so, should IVariable.isStatic() return true for such a binding? This does not seem to be the case at the moment.

 

Many thanks,

Tom

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the addressee, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. If you have received this transmission in error please notify the sender immediately and then delete this email.

Any representations or commitments expressed in this email are subject to contract.

This message has been scanned for viruses and dangerous content. However, it is essential that the recipient also checks this message using commercially available mail scanning and anti-virus software. IPL Information Processing Limited accepts no liability for any loss or damage resulting from any virus or other dangerous content in this message.

IPL Information Processing Limited is registered in England and Wales under company registration number 1418818. Registration took place at Cardiff on 10 May 1979. IPL Information Processing Limited's registered office and normal place of business is Eveleigh House, Grove Street, Bath, BA1 5LR, United Kingdom. IPL is also registered for Value Added Tax (VAT) under registration number GB 601 2931 83.

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the addressee, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. If you have received this transmission in error please notify the sender immediately and then delete this email.

Any representations or commitments expressed in this email are subject to contract.

This message has been scanned for viruses and dangerous content. However, it is essential that the recipient also checks this message using commercially available mail scanning and anti-virus software. IPL Information Processing Limited accepts no liability for any loss or damage resulting from any virus or other dangerous content in this message.

IPL Information Processing Limited is registered in England and Wales under company registration number 1418818. Registration took place at Cardiff on 10 May 1979. IPL Information Processing Limited's registered office and normal place of business is Eveleigh House, Grove Street, Bath, BA1 5LR, United Kingdom. IPL is also registered for Value Added Tax (VAT) under registration number GB 601 2931 83.


Back to the top