When you're dealing with small integers that stand for themselves, theres 
neither benfit nor harm for making them named constants. It's "magic numbers" 
that you need to avoid, e.g., approximations, exchange rates.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Bob 
Bridges <robhbrid...@gmail.com>
Sent: Saturday, September 5, 2020 4:21 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Constant Identifiers

Going back to the beginning, Gil:  SQRT(X**TWO+Y**TWO) looks like ~exactly~ the 
sort of thing that oughta be made a constant rather than being coded more than 
once.  That is, if X, Y and TWO all constants themselves; and if they are not 
then this isn't an example of what you're talking about.  Did you accidentally 
reverse your meaning?  Or what am I missing?

---
Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313

/* Anarchy might be great, if only it could be enforced.  -Joseph Sobran, 
2001-03-27 */

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Paul Gilmartin
Sent: Friday, September 4, 2020 11:44

I'm a PL/I novice, or less.  A recent thread here moved me
to browse the Ref., where I read that any constant used more
than once must be declared and the identifier used instead.
Sorta tyrannical enforcement of coding conventions.  OK.
I agree that 6.62607015e−34 shouldn't be hard-coded more
than once.  But SQRT( X**TWO + Y**TWO )?  Ugh!

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

Reply via email to