Do you have a URL and page number? Is that an exact quote, or was there a 
conditional?

It is good form to use a constant that stands for itself, e.g., "X**2". It is 
bad form to use a constant for, e.g., an approximation, an empirical value, a 
value subject to regulatory change. The general rule is to avoid "magic 
numbers". Thus, things like PI, E, MAX_INTEREST_RATE should have names.

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


________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Paul Gilmartin <[email protected]>
Sent: Friday, September 4, 2020 11:43 AM
To: [email protected]
Subject: Constant Identifiers

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!

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to