Chapter 9. Common API Programming Errors
This chapter contains information identified as common programming errors
encountered when using APIs within application programs. The chapter design
provides two program examples for each common error. The first program
example is incorrectly coded and is followed by the correctly coded example. If you
encounter errors or problems while working with APIs, these examples may provide
ideas or solutions.
Note: Do not assume that an API will do things other than what the
System API
Reference
mentions. If the manual does not say specifically that it is
allowed, it probably is not.
Figure 9-1 identifies common API programming errors and refers you to examples
that show you how to avoid the errors.
Figure 9-1. Common Programming Errors
Task Location of Example
Using the error code param-
eter
Page 9-2
Defining data structures Page 9-5
Defining receiver variables Page 9-10
Defining list entry format
lengths
Page 9-14
Using null pointers with OPM
APIs
Page 9-18
Defining byte alignment Page 9-22
Using offsets in user space Page 9-27
Coding for new function Page 9-36
Copyright IBM Corp. 1997 9-1