Talk About Network

Google





Computer Aided Design - CAD > Cadence > Re: what is the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 5 Topic 4006 of 4397
Post > Topic >>

Re: what is the assignment expression return value?

by Andrew Beckett <andrewb@[EMAIL PROTECTED] > May 15, 2008 at 09:15 PM

vlsidesign wrote, on 05/14/08 22:55:
> On May 14, 12:16 pm, vlsidesign <ford...@[EMAIL PROTECTED]
> wrote:
>> I believe in C, an assignment expression returns the value of the left
>> side of the assignment. For example, a = 2, would return 2.
>>
>> If this is true, is Skill similar? For instance, if I have the
>> following, a = nil, would it return nil ?
> 
> It seems like it would return nil but for different reason than C. I
> believe it returns the value of the expression on the right side that
> happens to be what is assigned to a.

The assignment operator is converted into functional equivalent, by
working
from right to left. Most operators work left to right:


 > sstatus(printinfix nil)
nil
 > '(a=b=c=d=5)
(setq a
     (setq b
         (setq c
             (setq d 5)
         )
     )
)

The above shows you the functional equivalent (i.e. how it is actually
implemented)
for a=b=c=d=5. So you can see precedence and left-to-right/right-to-left
handling
by looking at the output of that.

So it behaves just like C in this respect - the compiler expands =
operators right to left.

Regards,

Andrew.
 




 5 Posts in Topic:
what is the assignment expression return value?
vlsidesign <fordgwf@[E  2008-05-14 12:16:36 
Re: what is the assignment expression return value?
vlsidesign <fordgwf@[E  2008-05-14 14:55:09 
Re: what is the assignment expression return value?
Andrew Beckett <andrew  2008-05-15 21:15:31 
Re: what is the assignment expression return value?
Riad KACED <riad.kaced  2008-05-14 15:02:53 
Re: what is the assignment expression return value?
Riad KACED <riad.kaced  2008-05-14 15:08:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 14:32:40 PST 2009.