× 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.


  • Subject: Re: C style assignment of variable values
  • From: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Tue, 05 Oct 1999 14:19:08 -0700
  • Organization: Conex Global Logistics Services, Inc.

EVAL A, B, C = 0
I like.  I can understand what that is doing.

I remember seeing an expression in basic
a = b = c = e = f = 0
and I hated that.  Because = can be boolean or an equation.

(couldn't that be saying, if F = 0 and E = (F = 0) and C = (E = (F = 0)) etc..
and evaluate to true or false and be applied to a? as hans says?)

Regards,

Jim Langston

boldt@ca.ibm.com wrote:

> <SNIP>
> Unfortunately, the = operator is overloaded in RPG IV.  It's used
> for both assignment and comparison.  The above EVAL statement is
> almost valid today.  Replace it with, say:
>
> EVAL    A = B = C
>
> and you'd have a valid RPG IV statement.  It wouldn't do what you
> expected, though.  First, expression B = C would be evaluated
> giving an indicator value.  The result of that comparison would
> then be assigned to A.
>
> The main issue here is that in RPG IV, assignment is considered a
> statement.  But in other languages, like C and Perl, it is an
> expression.  With assignment as an expression, you run into such
> messy issues like order of evaluation and side effects.  (Not to
> mention the common C bug: if(a=b)!)
>
> OTOH, we could possibly come up with some different syntax like:
>
> EVAL    A, B, C = 0
>
> Cheers!  Hans
>
> Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
>
> +---
> | 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
> +---

+---
| 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 ...

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.