Previous | Next | Table of Contents | Index | Program List | Copyright

11.6 Tricks of the Trade: Common Programming Errors

When dealing with unconstrained array types, a common error is neglecting to supply bounds when a variable is declared, which leads to a compilation error. Keep in mind that bounds are generally not supplied when declaring a procedure or function parameter whose type is an unconstrained array type.

When writing generic specifications, it is sometimes difficult to figure out exactly which formal parameters to write. We have studied generic type parameters only briefly, and you are wise to keep your generic specifications simple, following the examples in the chapter. Neglecting to supply a generic procedure or function parameter (such as "+" in the vectors package) will result in a compilation error if the compiler encounters that procedure or function in the body. We always need to reassure the compiler that an appropriate operation will be supplied at instantiation, and the way to do this is by defining appropriate formal parameters.


Previous | Next | Table of Contents | Index | Program List | Copyright

Copyright © 1996 by Addison-Wesley Publishing Company, Inc.