什么是i +++增量在c ++ [英] What is i+++ increment in c++

查看:204
本文介绍了什么是i +++增量在c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

这是一个语法错误。

任何人都可以告诉我什么是i +++在c ++中递增的过程。 p>

使用最大限制规则 i +++ 被标记为:

  i ++ + 
/ pre>

最后 + 是一个二进制加法运算符。但显然它没有两个操作数导致解析器错误。



编辑:



注释的问题:我们可以有 i ++++ j



  i ++ ++ j 

这又是一个语法错误,因为 ++ 是一元运算符。



在类似行 i +++++ j 被扫描器标记为:

  i ++ ++ + j 

c ++)+ j 这也是错误的,因为 i ++ 不是一个左值并使用 / code>不允许。


can anyone tell me what is the process of i+++ increment in c++.

解决方案

It is a syntax error.

Using the maximum munching rule i+++ is tokenized as:

i ++ +

The last + is a binary addition operator. But clearly it does not have two operands which results in parser error.

EDIT:

Question from the comment: Can we have i++++j ?

It is tokenized as:

i ++ ++ j

which again is a syntax error as ++ is a unary operator.

On similar lines i+++++j is tokenized by the scanner as:

i++ ++ + j

which is same as ((i++)++) + j which again in error as i++ is not a lvalue and using ++ on it is not allowed.

这篇关于什么是i +++增量在c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆