Topic: How do identifiers and names differ?


Author: allan_w@my-dejanews.com (Allan W)
Date: Fri, 21 Mar 2003 21:36:52 +0000 (UTC)
Raw View
musiphil@bawi.org (KIM Seungbeom) wrote
> 3/p4 states that "A name is a use of an identifier (2.10) that denotes
> an entity or label (6.6.4, 6.1)." This seems to imply that names are
> a subset of identifiers, but I cannot think of any examples that fall
> into identifiers but not into names.

> Furthermore, the C++ Standard says that scopes and linkages are
> properties of names, while the C Standard says that they are properties
> of identifiers. I don't think the concepts of scopes and linkages
> are fundamentally different in C and C++.
>
> So, are identifiers and names really different concepts? If so, how?

This is just a guess --
Most C++ programs must use identifiers that are not part of the
language proper. For instance, if you open a file you must supply the
path (usually) and the filename. Let's call this combination a
"File identifier."

Surely the File Identifier has neither scope nor linkage. It also
does not denote an entity (at least not a C++ entity) nor a C++ label,
so this definition is at least consistent.

The only thing I see wrong with this is, it goes against common English
usage. After all, we say that a file has a file name, not a file
identifier.

Eager to hear some alternative explanation...

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: musiphil@bawi.org (KIM Seungbeom)
Date: Thu, 20 Mar 2003 18:15:36 +0000 (UTC)
Raw View
3/p4 states that "A name is a use of an identifier (2.10) that denotes
an entity or label (6.6.4, 6.1)." This seems to imply that names are
a subset of identifiers, but I cannot think of any examples that fall
into identifiers but not into names.

Furthermore, the C++ Standard says that scopes and linkages are
properties of names, while the C Standard says that they are properties
of identifiers. I don't think the concepts of scopes and linkages
are fundamentally different in C and C++.

So, are identifiers and names really different concepts? If so, how?

--
KIM Seungbeom <musiphil@bawi.org>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: v.Abazarov@attAbi.com ("Victor Bazarov")
Date: Thu, 20 Mar 2003 20:28:09 +0000 (UTC)
Raw View
"KIM Seungbeom" <musiphil@bawi.org> wrote...
> 3/p4 states that "A name is a use of an identifier (2.10) that denotes
> an entity or label (6.6.4, 6.1)." This seems to imply that names are
> a subset of identifiers, but I cannot think of any examples that fall
> into identifiers but not into names.

Keywords are identifiers.

> Furthermore, the C++ Standard says that scopes and linkages are
> properties of names, while the C Standard says that they are properties
> of identifiers. I don't think the concepts of scopes and linkages
> are fundamentally different in C and C++.
>
> So, are identifiers and names really different concepts? If so, how?

typedef int ANOTHERINT;
ANOTHERINT var;

There are four distinct identifiers in the program above.  Two
are names and two are not.  int is a [built-in] type.  'int' is
not a name, it is, however, an identifier.  OTOH, 'ANOTHERINT'
_is_ a name.  'var' is a name.  'typedef' is not a name.

An identifier is analysed and translated.  A name is looked up
after it's been determined that it's not a keyword.

IOW, names are a subset of identifiers.

    Names = Identifiers - Keywords.

Victor
--
Please remove capital A's from my address when replying by mail


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]