条件子句的复杂程度 [英] How complex the conditional clause is allowed

查看:87
本文介绍了条件子句的复杂程度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些人喜欢


返回(a == b)?a :((b == c)?:..)........... .....


谢谢

解决方案



Peter Liu skrev:


有些像


返回(a == b)?a :((b == c)?:..)................


谢谢



没有限制。你的编译器可能有一个,但你不太可能会遇到它。所以请继续使用机器生成的代码

;-)

/ Peter

Peter Liu写道:


主题:允许条件子句有多复杂



It在这些部分周围被认为是不好的形式,而不是把你的问题放在帖子的

正文中。


有些像


返回(a == b)?a :((b == c)?:..)................



标准没有施加限制。它建议编译器应该



完整表达式中支持至少256个带括号的表达式嵌套级别。

Best


Kai-Uwe Bux


Peter Liu写道:


喜欢


返回(a == b)?a:((b == c)?:..)................



这是合法且有用的。


返回a == b? 1

:a == c? 2

:a == d? 3

:4;


-


- Pete

Roundhouse咨询有限公司( www.versatilecoding.com

作者The Standard C ++ Library Extensions:a Tutorial and

Reference。 ( www.petebecker.com/tr1book


someting like

return (a==b)?a:((b==c)?:..)................

thanks

解决方案


Peter Liu skrev:

someting like

return (a==b)?a:((b==c)?:..)................

thanks

There is no limit. Your compiler might have one, but it is unlikely you
will encounter it. So just go ahead with your machine-generated code
;-)

/Peter


Peter Liu wrote:

Subject: How complex the conditional clause is allowed

It is considered poor form around these parts not put your question in the
body of your post.

someting like

return (a==b)?a:((b==c)?:..)................

The standard does not impose a limit. It recommends that a compiler should
support at least 256 nesting levels of parenthesized expressions within a
full expression.
Best

Kai-Uwe Bux


Peter Liu wrote:

someting like

return (a==b)?a:((b==c)?:..)................

This is legal and useful.

return a == b ? 1
: a == c ? 2
: a == d ? 3
: 4;

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)


这篇关于条件子句的复杂程度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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