How VOS PL/I tames PL/I 
Author Message
 How VOS PL/I tames PL/I

The Stratus VOS PL/I compiler ("Subset G"), acquired in 1980
from Translation Systems, Inc.  (Bob Freiburghouse, President
and author), unconditionally diagnoses some common PL/I issues,
and conditionally diagnoses others.  The following list gives
you a flavor, but is not necessarily complete.

These constructs are diagnosed unconditionally, as a level-1
warning (the compiler makes an assumption and continues):
     1.   Undeclared names.
     2.   Implicit conversion of arithmetic value to
          bit-string value.
     3.   Implicit conversion of arithmetic value to
          char(1) target.

These constructs are diagnosed when the -system_programming
option, or system_programming pragma, is used:
     4.   Implicit conversion of string value to numeric value.
     5.   Missing elements in a label array that has no
          "default" case. (A default case is a VOS extension;
          we use "label (*):" to specify the default).
     6.   Referencing a member of a structure without specifying
          the level-1 structure name.
     7.   Certain cases of alignment padding in structures.

We require all of our own code ("system code") to be compiled
with -system_programming.  Over the years we've had good success
with this list of checks.

In all cases there are simple ways to rewrite the code to
eliminate the warning.  The implicit string-to-numeric
conversion warnings go away if you make them explicit by using
the FIXED or BINARY builtins.  The implicit arithmetic to string
warnings to away if you use BIT or CHAR.  And you always have
pictured conversions.

I particularly like the requirement that all references to
members of structures must have at least the level-1 name
present.  Thus, when I read a program, I know that the names in
the following statement are not tucked away in some structure:

     user_name = person_name || '.' || group_name;

and that if I ever add any of these names to a structure, I'll
get a diagnostic until I change the program.

The implicit conversion warnings catch sloppy programming, such
as:

     do while (1); ... end;   should be while('1'b)

     string_var = numeric_exp; should use BIT or CHAR to convert.

     bitstring = 1;           instead of bitstring = '1'b;

     call subr (integer);     when subr actually wants char.

     numeric_var = string_exp; should be numeric_var=BIF(string_exp)
                              where BIF is FIXED,BINARY,FLOAT,or DEC

Since these rules apply in all contexts, we check not only
assignment statements, but argument lists in call statements,
do-loop variables, if-statement expressions, etc.

Note that we do not diagnose implicit conversion of fixed-point
arithmetic values to or from floating-point arithmetic values.
Some cases of decimal-to-binary are diagnosed if the compiler
knows that precision loss is possible.

All-in-all, having worked with this compiler for nearly 16
years, I can say that the errors that I still make while
programming are not due to the compiler making assumptions about
my program.

My non-algorithmic errors tend to be due to sloppiness.  For
example, I sometimes have a little trouble making my pictures
large enough to convert the maximum value, but when I remember
to reference my cheat sheet, where I've written these things
down, I do OK.

PG
--

Director, VOS Planning   | Voice: +1 508-460-2557   FAX: +1 508-460-0397
Stratus Computer, Inc.   | Video: PictureTel/AT&T by request.
Marlboro, MA  01752      | Disclaimer: I speak for myself, not Stratus.



Tue, 04 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VOS PL/I programmers needed Chicago

2. IS:: job--NY--VOS programmer--PL/1, C, Appletree--financial

3. Logo Komeniusz PL (Logo Comenius PL)

4. Derivation of PL/I (was Usenet group for PL/M language)

5. Mapping local files to FILE declarations in PL/I with IBM VisualAge PL./I for Windows

6. Difference PL/1 PL/I

7. What is the difference between DEC PL/1 and OS/390 PL/1

8. Initialization Expressions in PL/I (was ANSI PL/I)

9. Migrating from OS/VS PL/I to VA PL/I

10. PL/I FAQ -- Frequently asked questions about PL/I (minor update)

11. The PL/I Connection (PL/I Newsletter No. 6)

12. PL1 JOBS PL/I Jobs PL/1 JOBS

 

 
Powered by phpBB® Forum Software