Roedy Green wrote:
> On Sun, 30 Sep 2007 10:47:13 -, Summercool
> <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone
> who said :
>> and now n will be 3. I think C++ and PHP can let you do that, using
>> their reference (alias) mechanism. And C, Python, and Ruby probably
>> won't
Summercool <[EMAIL PROTECTED]> writes:
> I wonder which language allows you to change an argument's value?
[...]
> What about Java and Perl?
Perl will let you change the value of a passed-in object directly.
Others have already answered about Java.
> is there any way t
On Sep 30, 6:49 pm, Summercool <[EMAIL PROTECTED]> wrote:
> On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote:
> > SpringFlowers AutumnMoon wrote:
> > > we have no way
> > > of knowing what we pass in could get changed.
> > Sure you do. You look at the function's signature. In order to use
On 2007-09-30 23:03, Arne Vajhøj wrote:
> Erik Wikström wrote:
>>> their reference (alias) mechanism. And C, Python, and Ruby probably
>>> won't let you do that. What about Java and Perl?
>>
>> C will let you do it with pointers (it is just a syntactical difference
>> from references in this cas
> Neither C or Java has call by reference.
> C pointers and Java references may work similarly in most cases
> but it is still call by value.
so what? the references in c++ are passed by value too, its just a nice
interface to pointers.
At the end those parameters are pushed on the stack .. thats i
On Sun, 30 Sep 2007 10:47:13 -, Summercool
<[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone
who said :
>and now n will be 3. I think C++ and PHP can let you do that, using
>their reference (alias) mechanism. And C, Python, and Ruby probably
>won't let you do that. What about J
Erik Wikström wrote:
>> their reference (alias) mechanism. And C, Python, and Ruby probably
>> won't let you do that. What about Java and Perl?
>
> C will let you do it with pointers (it is just a syntactical difference
> from references in this case) and Java's references allows it.
Neither C
Erik Wikström wrote:
> On 2007-09-30 18:49, Summercool wrote:
>> On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote:
>>> SpringFlowers AutumnMoon wrote:
we have no way
of knowing what we pass in could get changed.
>>> Sure you do. You look at the function's signature. In order to us
Summercool wrote:
> I wonder which language allows you to change an argument's value?
> like:
>
> foo(&a) {
> a = 3
> }
>
> n = 1
> print n
>
> foo(n) # passing in n, not &n
> print n
>
> and now n will be 3. I think C++ and
.oO(Summercool)
>I think in Pascal and C, we can never have an
>argument modified unless we explicitly allow it, by passing in the
>pointer (address) of the argument.
Pascal also allows passing by reference, which is done with the keyword
'var' when declaring the function parameters. Object Pasca
Summercool wrote:
> On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote:
>> SpringFlowers AutumnMoon wrote:
>>> we have no way
>>> of knowing what we pass in could get changed.
>> Sure you do. You look at the function's signature. In order to use
>> someone else's library, you have to know the
On 2007-09-30 18:49, Summercool wrote:
> On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote:
>> SpringFlowers AutumnMoon wrote:
>> > we have no way
>> > of knowing what we pass in could get changed.
>>
>> Sure you do. You look at the function's signature. In order to use
>> someone else's lib
On Sep 30, 3:47 am, Summercool <[EMAIL PROTECTED]> wrote:
> I wonder which language allows you to change an argument's value?
> like:
>
> foo(&a) {
> a = 3
>
> }
>
> n = 1
> print n
>
> foo(n) # passing in n, not &n
> print n
>
&g
On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote:
> SpringFlowers AutumnMoon wrote:
> > we have no way
> > of knowing what we pass in could get changed.
>
> Sure you do. You look at the function's signature. In order to use
> someone else's library, you have to know the function's signature
On 2007-09-30 12:47, Summercool wrote:
> I wonder which language allows you to change an argument's value?
> like:
>
> foo(&a) {
> a = 3
> }
>
> n = 1
> print n
>
> foo(n) # passing in n, not &n
> print n
>
> and now n will be 3. I
En Sun, 30 Sep 2007 07:47:13 -0300, Summercool <[EMAIL PROTECTED]>
escribi�:
> I wonder which language allows you to change an argument's value?
> like:
>
> foo(&a) {
> a = 3
> }
>
> n = 1
> print n
>
> foo(n) # passing in n, not &n
>
On 30 sep, 12:47, Summercool <[EMAIL PROTECTED]> wrote:
> I wonder which language allows you to change an argument's value?
> like:
>
> foo(&a) {
> a = 3
>
> }
>
> ...
> is there any way to prevent a function from changing the argument's
I wonder which language allows you to change an argument's value?
like:
foo(&a) {
a = 3
}
n = 1
print n
foo(n) # passing in n, not &n
print n
and now n will be 3. I think C++ and PHP can let you do that, using
their reference (alias) mechanism. And C, Python, and Ruby p
18 matches
Mail list logo