Re: How to eliminate this global variable, silent?



Joe Wright wrote:
jameskuyper@xxxxxxxxxxx wrote:
....
Section 6.4.2.1p1 specifies, with great precision, what an identifier
is:

_identifier_:
_identifier-nondigit_
_identifier identifier-nondigit_
_identifier digit_

_identifier-nondigit_:
_nondigit_
_universal-character-name_
other implementation-defined characters

_nondigit_: one of
_ a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

_digit_: one of
0 1 2 3 4 5 6 7 8 9

Paragraph 3 explains the "other implementation-defined characters":
"An implementation may allow multibyte characters that are not part of
the basic source character set to
appear in identifiers; which characters and their correspondence to
universal character names is implementation-defined."

The characters '[' and ']' do not meet the requirements for qualifying
as either "digits" or "non-digits". Since they are part of the basic
source character set, they also can't qualify under the 'other'
category. Therefore they cannot appear anywhere in an identifier.

The C standard describes a[2] as a postfix-expression consisting of
the identifier "a", which parses as a postfix-expression in it's own
right, the subscript operator consisting of the tokens "[" and "]",
and the integer literal "2" which parses as an expression in this
context. See 6.5.2p1:

_postfix-expression_:
...
_postfix-expression_ [ _expression_ ]

Damn, this is a tough room. I now concede a[2] an expression, not an identifier. But it is an object of type int and a variable. Right?

I agree that it is an object; it is a sub-object of the aggregate object referred to by 'a'. However, my understanding is that a variable is a named object, i.e. one that can be identified using just an identifier. Therefore, I don't agree that it is a variable.

However, I see that user92300 has recently cited ISO/IEC 11404 (unfortunately, not the relevant standard) which defines the term "variable", in a way that's incompatible with my understanding. I'm preparing myself for the possibility that the relevant standard (ISO/IEC 2382) has a similar definition. If so, then you're right on both counts.
.



Relevant Pages

  • Re: [OT] I love that writing style. (Was: Re: Is this Regular Expression for UTF-8 Correct??)
    ... consider if the following were a specifcation for a C identifier: ... characters from being used for Identifiers. ... sense from the perspective of natural language. ... to use accented characters is a similar burden. ...
    (microsoft.public.vc.mfc)
  • Re: Stored proc with version number ?
    ... in addition to letter characters from other languages. ... > Certain symbols at the beginning of an identifier have special meaning ... > Need SQL Server Examples check out my website ... >> the existing stored proc uspTableSave and right click Properties. ...
    (microsoft.public.sqlserver.programming)
  • Re: Stored proc with version number ?
    ... in addition to letter characters from other languages. ... Certain symbols at the beginning of an identifier have special meaning ... in SQL Server. ... I choose> the existing stored proc uspTableSave and right click Properties. ...
    (microsoft.public.sqlserver.programming)
  • Re: [OT] I love that writing style. (Was: Re: Is this Regular Expression for UTF-8 Correct??)
    ... consider if the following were a specifcation for a C identifier: ... It is not whether or not that it makes sense within the context of natural human language that restricts the use of these punctuation characters from being used for Identifiers. ... to use accented characters is a similar burden. ...
    (microsoft.public.vc.mfc)
  • Re: Way to check that a column name can be used in SQL Server?
    ... I want to be compatible with SQL Server ... The rules for the format of regular identifiers depend on the database ... of letters includes Latin characters from a through z, from A through Z, ... Certain symbols at the beginning of an identifier have special meaning ...
    (microsoft.public.data.ado)