Grant Edwards wrote:
We do not consider passing a pointer as*by value*  because its an
>  address; by definition, that is pass-by-reference.
No, it isn't.  It's pass by value.  The fact that you are passing a
value that is a pointer to another value is not relevent.


@ Edwards, &Schaathun

You are most definitely mistaken.   See:

http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr233.htm


I understand that semantically some people insist that when C receives parms as pointers that pass-by-reference is only being simulated.

But that is the silliness of this argument... because down in the guts of the ALU we only have direct and indirect memory addressing. Period.

You either pass a function the memory directly (value) or you pass the data indirectly (reference).

Everything above that is high-level semantics.


If I want to pass values to my C functions, I can. If I want to pass references to my C functions, I can.

If I want to implement a C language that does not use pointers directly (hides them) I can implement pass by reference completely (on the surface). In fact, I can implement the C compiler so that pass by value is not allowed! [ it wouldn't look much like C, but its do-able ]


Everyone forgets that their high-level language is not 'really' what's working... gcc does not produce machine code... it produces assembler instructions that are passed to a translator... you can interrupt the process and have it produce the assembly instructions so you can see them if you want to... the point being, after all is said and done, all you can do with today's von Neumann processors is pass data directly (value) or indirectly (reference).

Everything else is semantics.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to