Previous: Conforming Implementations, Up: Conformance


1.5.2 Conforming Programs

Code conforming with the requirements of this standard shall adhere to the following:

  1. Conforming code shall use only those features of the language syntax and semantics that are either specified in this standard or defined using the extension mechanisms specified in the standard.
  2. Conforming code may use implementation-dependent features and values, but shall not rely upon any particular interpretation of these features and values other than those that are discovered by the execution of code.
  3. Conforming code shall not depend on the consequences of undefined or unspecified situations.
  4. Conforming code does not use any constructions that are prohibited by the standard.
  5. Conforming code does not depend on extensions included in an implementation.
1.5.2.1 Use of Implementation-Defined Language Features

Note that conforming code may rely on particular implementation-defined values or features. Also note that the requirements for conforming code and conforming implementations do not require that the results produced by conforming code always be the same when processed by a conforming implementation. The results may be the same, or they may differ.

Conforming code may run in all conforming implementations, but might have allowable implementation-defined behavior that makes it non-portable code. For example, the following are examples of forms that are conforming, but that might return different values in different implementations:

 (evenp most-positive-fixnum)  implementation-dependent
 (random)  implementation-dependent
 (> lambda-parameters-limit 93)  implementation-dependent
 (char-name #\A)  implementation-dependent
1.5.2.1.1 Use of Read-Time Conditionals

Use of #+ and #- does not automatically disqualify a program from being conforming. A program which uses #+ and #- is considered conforming if there is no set of features in which the program would not be conforming. Of course, conforming programs are not necessarily working programs. The following program is conforming:

(defun foo ()
  #+ACME (acme:initialize-something)
  (print 'hello-there))

However, this program might or might not work, depending on whether the presence of the feature ACME really implies that a function named acme:initialize-something is present in the environment. In effect, using #+ or #- in a conforming program means that the variable *features* becomes just one more piece of input data to that program. Like any other data coming into a program, the programmer is responsible for assuring that the program does not make unwarranted assumptions on the basis of input data.

1.5.2.2 Character Set for Portable Code

Portable code is written using only standard characters.