HP3000-L Archives

April 1995, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Date:
Sun, 2 Apr 1995 00:21:05 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (87 lines)
Dr. Ferenc Nagy ([log in to unmask]) wrote:
 
: >     1        PROCEDURE DBCALL(L'STATUS,L'BUF,BUF'LEN);
: >     2           LOGICAL ARRAY L'STATUS,L'BUF;
: >     3           INTEGER                      BUF'LEN;
: >     4           OPTION EXTERNAL;
: ...
: What does the OPTION EXTERNAL mean?
: Why did you use L'... names?
 
"Option external" means: the body of the procedure is not in this file.
Instead, the compiler is told that someone will provide the code later
(perhaps the SEGMENTER at PREP time, or an SL, or SL.PUB.SYS at load time)
 
The "L'" is a variation of a naming convention that identifies the type
of a variable.
 
The "'" is SPL's version of "_" used by Pascal and C.
SPL didn't choose to use "_" because that's an ASCII analog of the
EBCDIC left-arrow, which is a reserved symbol in the lanuage (thanks
to ALGOL-60.
 
 
I strongly recommend, that a suffix of "'L" be used instead of a "L'" prefix.
 
Why?
 
Consider:
 
   logical array
      l'status   (0 : 9);
 
   byte array
      b'status   (*) = l'status;
 
vs.
 
   logical array
      status'l   (0 : 9);
 
   byte array
      status'    (*) = status';           (or, status'b that some people use)
 
In the former, when you get a cross reference or a $CONTROL MAP output,
the l'status and the b'status are *far away* from each other in the listing...
but they shouldn't be, since they describe the same area of memory.
 
In the latter, status'l and status' nicely sort to be next to each other,
which is more appropriate.
 
Additionally, reader sees "l'status" and thinks:
 
   1) FIRST, this is a logical array.
   2) SECOND, oh yes, it is a "status" variable.
 
In the latter method, the reader sees "status'l" and thinks:
 
   1) FIRST, this is a "status" variable".
   2) SECOND, it happens to be a logical array.
 
To me, it is *far* more important to immediately recognize that this
is a "status" variable than it is to understand the type ... particularly
since the type doesn't matter as much.
 
The only drawback of a "suffix" is that if a variable name is > 13
characters, the suffix falls off the end of the "usable" portion (in SPL)
..but the compiler quickly informs you of this problem.
 
So, I generally use suffixes of:
 
  suffix  SPL type
    ---   --------
    'z    long
    'd    double
    'r    real
    'i    integer
    '     byte         (some people use:   'b)
 
My coding conventions...yours may vary.
 
BTW, this was the original convention for the MPE lab ... back when I
wrote the lab's first SPL coding guidelines around 1979.  I don't know
if they still follow them.
 
Stan Sieler
[log in to unmask]

ATOM RSS1 RSS2