Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

請問Call By Name 是啥??....

0 views
Skip to first unread message

不屑+憂鬱的瓶子

unread,
Jan 5, 1999, 3:00:00 AM1/5/99
to
像Call By Address Call By Value...........
函數如指標就用Call By Address

int example(int *num)
......
..example(&num2);

那Call By Name 是啥......
舉例一下吧!!....

--
◎ [1;31m龍 [32m貓 [33m資 [34m訊 [35m天 [36m地 [0m( [1mbbs.mgt.ncu.edu.tw [0m)
◎[ [1;33;46mlailee [0m]來自: 140.115.226.72

柏原賓賓

unread,
Jan 5, 1999, 3:00:00 AM1/5/99
to
==> 在 laile...@bbs.mgt.ncu.edu.tw ("不屑+憂鬱的瓶 的文章中提到:

> 像Call By Address Call By Value...........
> 函數如指標就用Call By Address
> int example(int *num)
> .......
> ...example(&num2);

> 那Call By Name 是啥......
> 舉例一下吧!!....

Call by Name 是不是就是 Call by Referance
如果是的話那就是

int example(int& num);

int main(void)
{
int num;
.
.
.
example(num);
.
.
.
return 0;
}

int example(int& num)
{
.
.
.
return (...);
}
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>

滿足現況...:P

unread,
Jan 5, 1999, 3:00:00 AM1/5/99
to
==> 在 laile...@bbs.mgt.ncu.edu.tw ("不屑+憂鬱的瓶 的文章中提到:
> 像Call By Address Call By Value...........
> 函數如指標就用Call By Address
> int example(int *num)
> .......
> ...example(&num2);
> 那Call By Name 是啥......
> 舉例一下吧!!....

Call by name 不等於 call by reference

要看你用的程式語言特性來說明

可以翻翻 program language 的課本

如果硬要用 c 來說明的話

define 的作法 比較像是 call by name 的方法

--
│ o ¯\ []----- ║ ║╭══╮ ║ ╭══╮
│ o ▅▇▇▇▆▅▄===============0 ╠══╣╠══╣ ║ ╠══╣
▊▃▆≡▆▆▆≡▆▆▆≡▆▆▆≡▆▆▅▃ ║ ╰╯ ╰═╬═╯ ╰
▊◤︻─︻─︻─︻─︻─︻─︻─︻─︻◥█◣╰╮I am bashful..╰═════
(◎ ◎ ◎ ◎ ◎ ◎ ◎ ◎ ◎) ║ and i always feel sad...
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ╭╯ 誰來找我哈拉呀 !!!!!

0 new messages