读书人

请问一个奇怪的语法 gt;gt; (值)(值)

发布时间: 2013-07-04 11:45:33 作者: rapoo

请教一个奇怪的语法 >> (值)(值)!
下面两句是某程序中的,编译通过,但是(值)(值)的语法不能理解!

UInt32 nArrValues[MaxCount];
Info.nArrValues[i] = (Info.nArrValues[i] * 10u + nType)(0u, 999999u);


自己测试写了一个类似的语法,但是同样的编辑器却编译通不过,为什么我的不行?
int xxx[32];
xxx[2] = (xxx[2] * 10u + 3)(0u, 999999u);

[解决办法]
自己写代码搞不清楚算符优先级请多加括号。
看别人代码搞不清楚算符优先级能调试的话请单步调试对应汇编。
看别人代码搞不清楚算符优先级不能调试的话想办法照写一小段孤立的可调试的代码然后单步调试对应汇编。
看别人代码搞不清楚算符优先级不能调试的话且没有办法照写一小段孤立的可调试的代码然后单步调试对应汇编的话只能参考算符优先级表猜了(提醒:并不能100%猜对)。
//C++ Operators
// Operators specify an evaluation to be performed on one of the following:
// One operand (unary operator)
// Two operands (binary operator)
// Three operands (ternary operator)
// The C++ language includes all C operators and adds several new operators.
// Table 1.1 lists the operators available in Microsoft C++.
// Operators follow a strict precedence which defines the evaluation order of
//expressions containing these operators. Operators associate with either the
//expression on their left or the expression on their right; this is called
//“associativity.” Operators in the same group have equal precedence and are
//evaluated left to right in an expression unless explicitly forced by a pair of
//parentheses, ( ).
// Table 1.1 shows the precedence and associativity of C++ operators
// (from highest to lowest precedence).
//
//Table 1.1 C++ Operator Precedence and Associativity
// The highest precedence level is at the top of the table.
//+------------------+-----------------------------------------+---------------+
//
[解决办法]
Operator
[解决办法]
Name or Meaning
[解决办法]
Associativity
[解决办法]

//+------------------+-----------------------------------------+---------------+
//
[解决办法]
::


[解决办法]
Scope resolution
[解决办法]
None
[解决办法]

//
[解决办法]
::
[解决办法]
Global
[解决办法]
None
[解决办法]

//
[解决办法]
[ ]
[解决办法]
Array subscript
[解决办法]
Left to right
[解决办法]

//
[解决办法]
( )
[解决办法]
Function call
[解决办法]
Left to right
[解决办法]

//
[解决办法]
( )
[解决办法]
Conversion
[解决办法]
None
[解决办法]

//
[解决办法]
.
[解决办法]
Member selection (object)
------解决方案--------------------


Left to right
[解决办法]

//
[解决办法]
->
[解决办法]
Member selection (pointer)
[解决办法]
Left to right
[解决办法]

//
[解决办法]
++
[解决办法]
Postfix increment
[解决办法]
None
[解决办法]

//
[解决办法]
--
[解决办法]
Postfix decrement
[解决办法]
None
[解决办法]

//
[解决办法]
new
[解决办法]
Allocate object
[解决办法]
None
[解决办法]

//
[解决办法]
delete
[解决办法]
Deallocate object
[解决办法]
None
[解决办法]

//
[解决办法]
delete[ ]
------解决方案--------------------


Deallocate object
[解决办法]
None
[解决办法]

//
[解决办法]
++
[解决办法]
Prefix increment
[解决办法]
None
[解决办法]

//
[解决办法]
--
[解决办法]
Prefix decrement
[解决办法]
None
[解决办法]

//
[解决办法]
*
[解决办法]
Dereference
[解决办法]
None
[解决办法]

//
[解决办法]
&
[解决办法]
Address-of
[解决办法]
None
[解决办法]

//
[解决办法]
+
[解决办法]
Unary plus
------解决方案--------------------


None
[解决办法]

//
[解决办法]
-
[解决办法]
Arithmetic negation (unary)
[解决办法]
None
[解决办法]

//
[解决办法]
!
[解决办法]
Logical NOT
[解决办法]
None
[解决办法]

//
[解决办法]
~
[解决办法]
Bitwise complement
[解决办法]
None
[解决办法]

//
[解决办法]
sizeof
[解决办法]
Size of object
[解决办法]
None
[解决办法]

//
[解决办法]
sizeof ( )
[解决办法]
Size of type
[解决办法]
None
[解决办法]

//
[解决办法]
typeid( )


[解决办法]
type name
[解决办法]
None
[解决办法]

//
[解决办法]
(type)
[解决办法]
Type cast (conversion)
[解决办法]
Right to left
[解决办法]

//
[解决办法]
const_cast
[解决办法]
Type cast (conversion)
[解决办法]
None
[解决办法]

//
[解决办法]
dynamic_cast
[解决办法]
Type cast (conversion)
[解决办法]
None
[解决办法]

//
[解决办法]
reinterpret_cast
[解决办法]
Type cast (conversion)
[解决办法]
None
[解决办法]

//
[解决办法]
static_cast
[解决办法]
Type cast (conversion)
[解决办法]
None
[解决办法]

//
------解决方案--------------------


.*
[解决办法]
Apply pointer to class member (objects)
[解决办法]
Left to right
[解决办法]

//
[解决办法]
->*
[解决办法]
Dereference pointer to class member
[解决办法]
Left to right
[解决办法]

//
[解决办法]
*
[解决办法]
Multiplication
[解决办法]
Left to right
[解决办法]

//
[解决办法]
/
[解决办法]
Division
[解决办法]
Left to right
[解决办法]

//
[解决办法]
%
[解决办法]
Remainder (modulus)
[解决办法]
Left to right
[解决办法]

//
[解决办法]
+
[解决办法]
Addition
[解决办法]
Left to right
------解决方案--------------------



//
[解决办法]
-
[解决办法]
Subtraction
[解决办法]
Left to right
[解决办法]

//
[解决办法]
<<
[解决办法]
Left shift
[解决办法]
Left to right
[解决办法]

//
[解决办法]
>>
[解决办法]
Right shift
[解决办法]
Left to right
[解决办法]

//
[解决办法]
<
[解决办法]
Less than
[解决办法]
Left to right
[解决办法]

//
[解决办法]
>
[解决办法]
Greater than
[解决办法]
Left to right
[解决办法]

//
[解决办法]
<=
------解决方案--------------------


Less than or equal to
[解决办法]
Left to right
[解决办法]

//
[解决办法]
>=
[解决办法]
Greater than or equal to
[解决办法]
Left to right
[解决办法]

//
[解决办法]
==
[解决办法]
Equality
[解决办法]
Left to right
[解决办法]

//
[解决办法]
!=
[解决办法]
Inequality
[解决办法]
Left to right
[解决办法]

//
[解决办法]
&
[解决办法]
Bitwise AND
[解决办法]
Left to right
[解决办法]

//
[解决办法]
^
[解决办法]
Bitwise exclusive OR
[解决办法]
Left to right
[解决办法]


//
[解决办法]

[解决办法]

[解决办法]
Bitwise OR
[解决办法]
Left to right
[解决办法]

//
[解决办法]
&&
[解决办法]
Logical AND
[解决办法]
Left to right
[解决办法]

//
[解决办法]

[解决办法]

[解决办法]
Logical OR
[解决办法]
Left to right
[解决办法]

//
[解决办法]
e1?e2:e3
[解决办法]
Conditional
[解决办法]
Right to left
[解决办法]

//
[解决办法]
=
[解决办法]
Assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
*=


[解决办法]
Multiplication assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
/=
[解决办法]
Division assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
%=
[解决办法]
Modulus assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
+=
[解决办法]
Addition assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
-=
[解决办法]
Subtraction assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
<<=
[解决办法]
Left-shift assignment
[解决办法]
Right to left
[解决办法]

//
------解决方案--------------------


>>=
[解决办法]
Right-shift assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
&=
[解决办法]
Bitwise AND assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]

[解决办法]
=
[解决办法]
Bitwise inclusive OR assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
^=
[解决办法]
Bitwise exclusive OR assignment
[解决办法]
Right to left
[解决办法]

//
[解决办法]
,
[解决办法]
Comma
[解决办法]
Left to right
[解决办法]

//+------------------+-----------------------------------------+---------------+


计算机组成原理→DOS命令→汇编语言→C语言(不包括C++)、代码书写规范→数据结构、编译原理、操作系统→计算机网络、数据库原理、正则表达式→其它语言(包括C++)、架构……

对学习编程者的忠告:
眼过千遍不如手过一遍!
书看千行不如手敲一行!
手敲千行不如单步一行!
单步源代码千行不如单步对应汇编一行!

VC调试时按Alt+8、Alt+7、Alt+6和Alt+5,打开汇编窗口、堆栈窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应堆栈、内存和寄存器变化,这样过一遍不就啥都明白了吗。
对VC来说,所谓‘调试时’就是编译连接通过以后,按F10或F11键单步执行一步以后的时候,或者在某行按F9设了断点后按F5执行停在该断点处的时候。

[解决办法]
()()这种却是是一种语法啊,无参仿函数啊,举个例子,


 

读书人网 >C++

热点推荐