and Pascal :-)
Pascal makes the same difference between := (assignment) and = (comparison)
So does C.
BTW: a free Pascal compiler for mainframe targets:
http://bernd-oppolzer.de/job9.htm
https://www.facebook.com/StanfordPascal
https://github.com/StanfordPascal/Pascal
unfortunately only AMODE 24 at the moment.
Feel free to send comments offline :-)
Kind regards
Bernd
Am 16.07.2019 um 20:04 schrieb Seymour J Metz:
One of the things that I liked about Algol was that "=" was always a comparison operator; assignment was
":=". But even in PL/I that particular error is impossible: the "=" in "IF foo=bar" can
never be interpreted as assignment.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Tom
Marchant <0000000a2a8c2020-dmarc-requ...@listserv.ua.edu>
Sent: Monday, July 15, 2019 4:44 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Where put the notional constant in a condition (Was RE: JCL COND
Parameter)
On Mon, 15 Jul 2019 13:30:51 -0700, Charles Mills wrote:
Some C programmers are fond of if (7 == foo) rather than the more conventional
if (foo == 7) because if one gets in the habit of doing so and then
accidentally codes if (7 = foo) one gets a compile error rather than unexpected
behavior.
For those not familiar with C, foo == 7 is a relational expression, foo = 7 is
an assignment, and if (foo = 7) ... compiles as though one had coded
foo = 7; if (foo != 0) /* which will be true of course */ ...
which is not at all what was presumably intended.
7 = foo is always a compile-time error; you can't assign a variable to a
constant.
It's one of the things that I don't like about C.
While you can code if 7 = foo and the compiler will catch your error, there is
nothing
you can do to protect yourself against the mistake of if foo = bar.
--
Tom Marchant
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN