× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Phil,
    "Undefined operation?" Do you mean that you cannot assign values to
array elements in such a chain in C? If only I hadn't tossed all my C
compilers away. But, in Java it is very much defined. Expressions are
evaluated from left to right, assignments from right to left. So, array[3]
is assigned the value of 1. Clear as can be. To me. Maybe not to the guy who
updates my code.

    Now, you defend the var1 = var2 = var3 ... etc. string as being "pretty
clear." We'll forget for the moment that it is exactly that syntax I was
using. I pointed out that when I have to work on code done that way, it is
annoying and more difficult than need be. Because I need to modify a line of
code which affects far more than my variabe, var6 in my example, I run the
risk of making a mistake that will affect values I am not considering
debugging. Of course I know how to work with it, but that doesn't make his
choice any better.
    You see, what I will know when I do that is that he chose to save a few
keystrokes at the expense of maintainability. I certainly hope the rest of
his code is not so fraught with shortcuts!

Phil wrote:
>On Tue, Jun 19, 2001 at 12:53:56PM -0700, Chris Rehm wrote:
>> Consider this:
>> x=3;
>> array[x] = x = 1;
>
>This is an undefined operation in C (right up there with 'array[x] = x++'),
>and no one reasonably familiar with the language would do it.  I can't
>think of anything off the top of my head, but I would be very surprised if
>RPG were devoid of any statements whose behavior was officially undefined.
>
>> But more common, in your string of var1 = var2 = var3 = ... I have run
>> into this on occasion with dismay. That is because I am usually at that
>> point because I have to change the assignment to var6. Because the
>> original programmer took his cute little shortcut, my maintenance job is
>> peskier. So will the guy's job who must change assignments to var2 and
>> var9.
>
>I think the 'var1 = var2 = var3 = x' syntax is pretty clear.  All of the
>variables are being set to the same value (that value which is rightmost
>in the chain).  Want to set var2 to something else?  Just take it out of
>the chain and put it in a separate statement.

Chris Rehm
javadisciple@earthlink.net


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.