找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

巢课
电巢直播8月计划
查看: 501|回复: 1
打印 上一主题 下一主题

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

[复制链接]

47

主题

266

帖子

2730

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
2730
跳转到指定楼层
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 )

想知道我哪里出问题了!!
谢谢!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 支持!支持! 反对!反对!
争风吃醋是女人最大的弱点  争强好胜是所有男人的死穴

9

主题

46

帖子

873

积分

三级会员(30)

Rank: 3Rank: 3Rank: 3

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

点评

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

本版积分规则

关闭

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

巢课

技术风云榜

关于我们|手机版|EDA365 ( 粤ICP备18020198号 )

GMT+8, 2025-2-24 23:43 , Processed in 0.054963 second(s), 32 queries , Gzip On.

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

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

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