If this tool helped you, you can buy us a coffee ☕
Objective-C运算符优先级与结合性速查对照表
[]tools.level-oc-query.categories.primarytools.level-oc-query.associativity.left用于数组或集合下标访问;在 Objective-C 中方括号也用于向对象发送消息。
items[index] / [view setNeedsLayout]()tools.level-oc-query.categories.primarytools.level-oc-query.associativity.left改变表达式求值顺序,或调用 C 函数、Block、方法返回的函数指针。
(a + b) * c / NSLog(@"%@", text).tools.level-oc-query.categories.primarytools.level-oc-query.associativity.left访问结构体成员,也常用于 Objective-C 属性的点语法。
point.x / object.title->tools.level-oc-query.categories.primarytools.level-oc-query.associativity.left通过结构体指针访问成员。
node->next+atools.level-oc-query.categories.unarytools.level-oc-query.associativity.right保留数值本身,通常用于明确表达正值。
+count-atools.level-oc-query.categories.unarytools.level-oc-query.associativity.right返回操作数的相反数。
-offset++a / a++tools.level-oc-query.categories.unarytools.level-oc-query.associativity.right将变量加 1;前置形式先递增再取值,后置形式先取值再递增。
++index / index++--a / a--tools.level-oc-query.categories.unarytools.level-oc-query.associativity.right将变量减 1;前置形式先递减再取值,后置形式先取值再递减。
--index / index--(type)tools.level-oc-query.categories.unarytools.level-oc-query.associativity.right把表达式显式转换为指定 C 或 Objective-C 指针类型。
(UIView *)sender*atools.level-oc-query.categories.unarytools.level-oc-query.associativity.right读取指针指向位置的值。
*buffer&atools.level-oc-query.categories.unarytools.level-oc-query.associativity.right取得变量、结构体成员或对象指针变量的地址。
&error!tools.level-oc-query.categories.unarytools.level-oc-query.associativity.right对布尔或条件表达式取反。
!isHidden~tools.level-oc-query.categories.unarytools.level-oc-query.associativity.right对整数每一位取反。
~masksizeoftools.level-oc-query.categories.unarytools.level-oc-query.associativity.right返回类型或表达式占用的字节数,结果类型为 size_t。
sizeof(CGPoint)*tools.level-oc-query.categories.multiplicativetools.level-oc-query.associativity.left两个数值相乘。
width * scale/tools.level-oc-query.categories.multiplicativetools.level-oc-query.associativity.left执行数值除法;整数除法会截断小数部分。
total / count%tools.level-oc-query.categories.multiplicativetools.level-oc-query.associativity.left返回整数相除后的余数。
index % 2+tools.level-oc-query.categories.additivetools.level-oc-query.associativity.left数值相加,也可用于指针与整数的偏移。
x + y-tools.level-oc-query.categories.additivetools.level-oc-query.associativity.left数值相减,或两个指针相减得到元素距离。
max - min<<tools.level-oc-query.categories.shifttools.level-oc-query.associativity.left将整数二进制位向左移动指定数量。
1 << bit>>tools.level-oc-query.categories.shifttools.level-oc-query.associativity.left将整数二进制位向右移动指定数量。
flags >> 1>tools.level-oc-query.categories.relationaltools.level-oc-query.associativity.left判断左操作数是否大于右操作数。
count > limit>=tools.level-oc-query.categories.relationaltools.level-oc-query.associativity.left判断左操作数是否大于或等于右操作数。
count >= minimum<tools.level-oc-query.categories.relationaltools.level-oc-query.associativity.left判断左操作数是否小于右操作数。
index < total<=tools.level-oc-query.categories.relationaltools.level-oc-query.associativity.left判断左操作数是否小于或等于右操作数。
index <= lastIndex==tools.level-oc-query.categories.equalitytools.level-oc-query.associativity.left比较两个值是否相等;对象内容比较通常应使用 isEqual: 等方法。
status == 200!=tools.level-oc-query.categories.equalitytools.level-oc-query.associativity.left比较两个值是否不相等。
object != nil&tools.level-oc-query.categories.bitwisetools.level-oc-query.associativity.left对两个整数逐位执行与运算。
options & NSCaseInsensitiveSearch^tools.level-oc-query.categories.bitwisetools.level-oc-query.associativity.left对两个整数逐位执行异或运算。
mask ^ flag|tools.level-oc-query.categories.bitwisetools.level-oc-query.associativity.left对两个整数逐位执行或运算,常用于组合选项位。
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight&&tools.level-oc-query.categories.logicaltools.level-oc-query.associativity.left短路与;左侧为假时不再计算右侧表达式。
view != nil && !view.hidden||tools.level-oc-query.categories.logicaltools.level-oc-query.associativity.left短路或;左侧为真时不再计算右侧表达式。
cached || [self reloadData]?:tools.level-oc-query.categories.conditionaltools.level-oc-query.associativity.right根据条件在两个表达式之间选择一个结果。
title.length ? title : @"Untitled"=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right把右侧表达式结果写入左侧变量或属性。
self.title = title/=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right将左值除以右侧表达式后再赋回左值。
scale /= 2*=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right将左值乘以右侧表达式后再赋回左值。
height *= ratio%=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right将左值取余后再赋回左值。
index %= count+=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right将右侧表达式加到左值上并赋回。
x += delta-=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right从左值中减去右侧表达式并赋回。
remaining -= used<<=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right左移指定数量后赋回左值。
flags <<= 1>>=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right右移指定数量后赋回左值。
flags >>= 1&=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right执行按位与后赋回左值。
options &= allowed^=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right执行按位异或后赋回左值。
mask ^= flag|=tools.level-oc-query.categories.assignmenttools.level-oc-query.associativity.right执行按位或后赋回左值。
options |= UIViewAnimationOptionCurveEaseInOut,tools.level-oc-query.categories.commatools.level-oc-query.associativity.left从左到右依次求值多个表达式,整个表达式结果为最后一个表达式的值。
i++, j--
Dishonest Debtor Lookup
Quickly look up dishonest judgment debtor information and deadbeat list details to help you avoid risks and understand credit status.

MIME Type Reference Table
A quick reference tool for MIME types and file extensions used in web development.

JSON to Objective-C Class Generator
Automatically generate Objective-C model classes from JSON data for iOS and macOS development.
在Objective-C开发中,运算符的优先级和结合性直接影响表达式求值结果,稍有疏忽便会导致难以排查的逻辑错误。本工具提供完整的Objective-C运算符执行顺序对照表,清晰列出从最高到最低优先级的所有运算符及其结合性,帮助开发者快速查阅、准确理解求值规则,避免因优先级混淆引发的编码问题。
* 优先级高于加法 +,因此表达式 2 + 3 * 4 的结果为 14 而非 20;赋值运算符 = 为右结合,a = b = c 等价于 a = (b = c)。() 具有最高优先级,可以强制改变表达式默认的求值顺序,是明确计算意图的最直接方式。+ 是左结合,因此 a + b + c 按 (a + b) + c 计算;而赋值运算符 = 是右结合,a = b = 0 会先将 0 赋给 b,再将结果赋给 a。本对照表仅涵盖标准Objective-C运算符,可能不包含编译器扩展或特殊平台下的自定义运算符。在实际编码中,即使熟悉优先级规则,仍强烈建议在混合使用多种运算符时使用括号明确求值顺序,提升代码可读性和可维护性。本工具为纯静态内容展示,不收集任何用户数据,无隐私风险。
熟练运用运算符优先级是编写无歧义代码的基础。常见易错点包括:逻辑与 && 优先级高于逻辑或 ||;位与 & 优先级低于相等比较 ==;条件运算符 ?: 优先级较低且为右结合。在复合表达式中,编写单元测试或使用静态分析工具验证求值结果,可以有效避免潜在的优先级陷阱。