Skip to content

语法分析后续应调整的地方 #15

@lxx2013

Description

@lxx2013
运算符 解释 结合性
++a   --a 前缀自增与自减 从右到左
+a   -a 一元加与减
!   ~ 逻辑非和逐位非
(type) C 风格转型
*a 间接(解引用)
&a 取址
sizeof 取大小[注 1]
new   new[] 动态内存分配
delete   delete[] 动态内存分配

我们的 COStreamPP 对上述运算中的优先级的处理还不完美, 例如测试int i = !1-2;就会得到不正确的的结果(目前文法中先-!,与标准优先级不符), 需调整并测试.
1?2:3也有问题

C++ 运算符优先级

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions