zoukankan      html  css  js  c++  java
  • Identifiers

     

    Identifier

    An identifier is an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters, and most Unicode characters (disallowed are control characters and characters in the basic source character set). A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character). Identifiers are case-sensitive (lowercase and uppercase letters are distinct), and every character is significant.

    In expressions

    An identifier that names a variable, a function, or an enumerator can be used as an expression. The expression consisting of just the identifier returns the entity named by the identifier. The value category of the expression is lvalue if the identifier names a function, a variable, or a data member, and prvalue otherwise (e.g. an enumerator is a prvalue expression).

    Within the body of a non-static member function, each identifier that names a non-static member is implicitly transformed to a class member access expression this->member.

    这里有两个注意点,一个是value category,有以下几种lvalue,prvalue(pure rvalue)和xvalue。函数,变量和成员变量的value category是lvalue,其他的value category是prvalue。关于详细的value category官网有详细的解释,感兴趣的可以看下。后面可能会单独列出。另外一个是在非静态成员函数内,非静态成员变量是被隐式地转换成

    this->member访问的。

    Unqualified identifiers

    Besides suitably declared identifiers, the following can be used in expressions in the same role:

    Together with identifiers they are known as unqualified id-expressions.

    对于qualified identifiers编译器执行的是qualified name lookup,对于unqualified identifiers编译器执行的是unqualified name lookup。

    关于overloaded operator是一些重载操作;user-defined conversion function则是一些用户自定义的转换函数--Enables implicit conversion or explicit conversion from a class type to another type.如

    struct X {
        //implicit conversion
        operator int() const { return 7; }
    };

    执行以下语句是可以的
    X x; int n = static_cast<int>(x); // OK: sets n to 7 int m = x; // OK: sets m to 7
  • 相关阅读:
    【UVA–11997 K Smallest Sums 】
    【LA 3027 Corporative Network】
    【bzoj3173-最长上升子序列-一题两解】
    【Rain in ACStar HDU-3340】
    【Uva 11280 飞到弗雷德里顿】
    【Uva 10269 马里奥与公主的归途】
    【Uva 11604 编码都有歧义了】
    【RevolC FaeLoN Uva 10972】
    oracle解析xml(增加对9i版本的支持)
    acl操作记录
  • 原文地址:https://www.cnblogs.com/Wojoin/p/5160704.html
Copyright © 2011-2022 走看看