|
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Charles Wilt
* Global figurative constants
* Type relation = aunt
D gA C 'A'
myRelation = gA;
That's just plain silly.
Of course it is. Any advice on how to break the news to the person who
wrote it?
I tend to tie the constant value to the field:
d RELATION_AUNT
d c 'A'
d RELATION_UNCLE
d c 'U'
I like that too. I did have the same, but when I saw my code :
TypeRelation = RELATION_AUNT;
I decided to reduce my constant name to AUNT to avoid repetition.
One could argue that a constant should never be local. As
that would allow you to have different definitions of it in
different procedures.
Which defeats the purpose of a constant.
We have one programmer who likes to make everything local where possible.
In the case of a constant, it would be changed to global as soon as another
procedure needed the same constant.
How about this for a rule ? :
All constants declared directly in the source are local.
All global constants must be in a copy book.
The idea being to use standard definitions wherever possible.
Thanks, Charles.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.