Pass by name and pass by value-result languages

谁说我不能喝 提交于 2019-12-05 08:12:06

The wikipedia article on evaluation strategy suggests that call-by-value-result is supported by fortran. Call-by-name is supported by algol 68.

I think C Macros are Pass-by-name (not the C language itself of course). I don't know of any pass-by-value-result languages I'm afraid (to be honest I had to do a web search to find out what it means!).

if you pass a variable to a fortran function and you modify it there, you also modify it in the calling program:

psuedocode:

int j = 1
print j
addOne(j)
print j

would output:

1
2

I think CLIPS expert system language would be pass by name.

Both Java and C are pass-by-value language.

C is clearly a pass by value language.

Java is always been told "primitives are passed by value, objects are passed by reference". But since java object is a reference at anytime, so it is actually a reference value.

Java Language specification tells this: http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#37472

Algol supports pass-by-name as you can find some explanation here

I was told that Ada supports pass-by-value/result but haven't tried out yet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!