找回密码
 点一下
查看: 1723|回复: 7

if 语句会不会产生记忆体漏失?

[复制链接]
发表于 2010-1-15 11:41:14 | 显示全部楼层 |阅读模式
比如
if( 1>2 and 3>4) then
...
endif

会不会产生记忆体漏失?
要不要写成


set t=1>2 and 3>4
if( t) then
...
endif
call DestroyBoolExpr(t)
set t=null

?
发表于 2010-1-15 16:13:55 | 显示全部楼层
应该不会吧... 要是会的话,就不用玩了...
回复

使用道具 举报

发表于 2010-1-15 18:10:48 | 显示全部楼层
你那个if判断实际上是boolean类型的值的判断。
而boolean不会泄露。
回复

使用道具 举报

发表于 2010-1-15 20:01:32 | 显示全部楼层
以前不是听说过条件会泄漏么,条件也是布尔表达式吧……
回复

使用道具 举报

发表于 2010-1-15 20:04:54 | 显示全部楼层
条件是
boolexpr
而我们说的是boolean。
是两个东西。
回复

使用道具 举报

发表于 2010-1-15 20:12:15 | 显示全部楼层
and 返回的应该是boolexpr吧……
回复

使用道具 举报

发表于 2010-1-15 20:36:33 | 显示全部楼层
引用第5楼alive于2010-01-15 20:12发表的  :
and 返回的应该是boolexpr吧……
………………
一个例子:
[jass]
function The_Condition takes nothing returns boolean
    return IsUnitType( GetTriggerUnit(), UNIT_TYPE_HERO )
endfunction

function Main takes nothing returns nothing
    local boolexpr cond = Condition(function The_Condition )
    local boolean bool = IsUnitType( GetTriggerUnit(), UNIT_TYPE_HERO )
    call DestroyBoolExpr( cond )
    set cond = null
endfunction
[/jass]
回复

使用道具 举报

发表于 2010-1-15 20:52:27 | 显示全部楼层
引用第6楼血戮魔动冰于2010-01-15 20:36发表的  :

………………
一个例子:
[jass]
function The_Condition takes nothing returns boolean
.......
呃……那么boolexpr有哪些呢?我有一些糊涂了……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-4-27 16:50 , Processed in 0.038726 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表