4

There are different parameter passing techniques like - Call By Value, Call By Reference, Call By Value Result, Call By Name, Call By Text and Call By Need in Programming Languages.

I have seen implementations of Call By Value and Call By Reference in C/C++; but the other techniques were taught only with simple plain examples, where we are given that this example uses say "Call By Value Result" and so answer accordingly. I was wondering whether the other techniques have ever been implemented in C/C++ or any other languages or were they just theoretical?

Abhishek Potnis
  • 837
  • 8
  • 18
  • [... "C++ Does not support Pass-by-value-result, however it can be simulated."] [http://stackoverflow.com/a/5768802/2352671] – 101010 May 05 '14 at 09:09
  • 1
    You should really stick to one language at a time. – juanchopanza May 05 '14 at 09:12
  • Call by name explained here with some examples from ALGOL-60: http://stackoverflow.com/questions/838079/what-is-pass-by-name-and-how-does-it-work-exactly – jas May 05 '14 at 09:19

3 Answers3

1

C provided and still provides pass by value only.

alk
  • 69,737
  • 10
  • 105
  • 255
0

In C++ it's only by value or by reference. The other techniques can be simulated using existing C++ language constructs - specially crafted conversion operators and constructors.

Alex Shtoff
  • 2,520
  • 1
  • 25
  • 53
  • as an example the boost library [Parameter](http://www.boost.org/doc/libs/1_55_0/libs/parameter/doc/html/index.html) – frank May 05 '14 at 09:14
-1

Check this the diff usage of parameters passing technique http://c2.com/cgi/wiki?ParameterPassing

cooldude
  • 11
  • 3