找回密码
 注册
关于网站域名变更的通知
查看: 809|回复: 1
打印 上一主题 下一主题

求大大们帮个说明一下,一个很简单的东东!

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-7-24 10:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
@optional Option
The @optional option gives you another way to specify a flexible number of arguments.With
@optional, each argument on the actual argument list is matched up with an argument on
the formal argument list.
You can provide any optional parameter with a default value. Specify the default value using
a default form. The default form is a two-member list. The first member of this list is the
optional parameter’s name. The second member is the default value.
The default value is assigned only if no value is assigned when the function is called. If the
procedure does not specify a default value for an argument, nil is assigned.
If you place @optional in the argument list of a procedure definition, any parameter following
it is considered optional.
The trBuildBBox function builds a bounding box.
procedure( trBuildBBox( height width @optional
( xCoord 0 ) ( yCoord 0 ) )
list(
xCoord:yCoord ;;; lower left
xCoord+width:yCoord+height ) ;;; upper right
) ; procedure
Both length and width must be specified when this function is called. However, the
coordinates of the box are declared as optional parameters. If only two parameters are
specified, the optional parameters are given their default values. For xCoord and yCoord,
those values are 0.
Examine the following calls to trBuildBBox and their return values:
trBuildBBox( 1 2 ) => ((0 0) (2 1))
trBuildBBox( 1 2 4 ) => ((4 0) (6 1))
trBuildBBox( 1 2 4 10) => ((4 10) (6 11))

以上是原文!!
我直接用了些程序试验提示说:function trBuildBBox redefined

以下是我复制的程序:
procedure( trBuildBBox( height width @optional
( xCoord 0 ) ( yCoord 0 ) )
list(
xCoord:yCoord ;;; lower left
xCoord+width:yCoord+height ) ;;; upper right
) ; procedure

trBuildBBox( 1 2 )

想知道我哪里出问题了!!
谢谢!

该用户从未签到

2#
发表于 2012-8-10 00:18 | 只看该作者
没有错啊, 那个提示是说 trBuildBBox 函数被重新定义了, 只能说明allegro加载了2次, 呵呵:)
或许是别人代码里也有这个东西, 以最后加载的定义为主哦
另外, SKILL以空格为分隔符, 小心 xCoord+width:yCoord+height  这个代码,符号 : 挺好的, 但也要小心由于空格和运算符优先级引起问题.

点评

欢迎Z大回归  发表于 2012-8-10 08:50
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-6-9 15:47 , Processed in 0.093750 second(s), 24 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

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