All:
I will find the truth by ur help,
I think follow code excute has 3 steps
==code=
$i = 0;
$i = $i++;
==code=
1. $i = 0;
2. $i = 1;( cause $i++ )
3. $i = 0;( cause $i = $i )
the third step is strange, because $i = 1;
why $i = $i get result 0, $i has 2 memory block
to
: [EMAIL PROTECTED]
Subject: Re: Strange Question? Is compiler fault?
All:
I will find the truth by ur help,
I think follow code excute has 3 steps
==code=
$i = 0;
$i = $i++;
==code=
1. $i = 0;
2. $i = 1;( cause $i++ )
3. $i = 0;( cause $i
All:
I excute follow code got some Strange result,
Why? Why $i = 0
===
$i = 0;
$i = $i++;
print $i\n;
===
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
cloud wrote:
although $i = $i run before $i++, But
the increment should be work, so $i should be 1, isn't it?
The precedence of ++ is higher than = , so the increment takes place
making $i = 1 and then $1 is set to the orig $i before the increment.
Replace
$i = $i++;
with just
$i=0;$i++;print$i\n;
will return 1
Chris Lerma
~~~
Lerma New Media
661.319.2412 cel
661.387.0868 phone/fax
[EMAIL PROTECTED]
www.LermaNewMedia.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
- Original Message -
From: cloud [EMAIL PROTECTED]
To: Paul G. Weiss [EMAIL PROTECTED]
Cc: '[EMAIL PROTECTED]'
[EMAIL PROTECTED]
Sent: Friday, June 15, 2001 1:59 PM
Subject: Re: Strange Question? Is compiler fault?
although $i = $i run before $i++, But
the increment should be work
All:
the precedence ++ is higer than =, thx -Paul, $Bill Luebkert
I know my sample is strange, I just confuse by that
why $x = $i++; $x = 1;
but $i = $i++; $i = 0;
although $i = $i run before $i++, But
the increment should be work, so $i should be 1, isn't it?
Hi,
Your script can
All:
I paest wrong sample, fllow is correct
why $x = $i++; $i = 1;
but $i = $i++; $i = 0;
All:
the precedence ++ is higer than =, thx -Paul, $Bill Luebkert
I know my sample is strange, I just confuse by that
why $x = $i++; $x = 1;
but $i = $i++; $i = 0;
although $i = $i run
Question? Is compiler fault?
The expression $i++ has the *effect* of incrementing $i
but its *value* is the value of $i before the increment.
So the assignment
$i = $i++;
is a no-op, because you are assigning to $i the value that
it had before the increment.
-Paul
On Fri, 15 Jun 2001
it?
- Original Message -
From: Paul G. Weiss [EMAIL PROTECTED]
To: cloud [EMAIL PROTECTED]
Cc: '[EMAIL PROTECTED]'
[EMAIL PROTECTED]
Sent: Friday, June 15, 2001 11:42 AM
Subject: Re: Strange Question? Is compiler fault?
The expression $i++ has the *effect* of incrementing $i
but its
10 matches
Mail list logo